geovista.themes#
Configures custom pyvista themes for geovista.
These themes are discoverable by pyvista and registered
through [project.entry-points] TOML table metadata (PEP621) in our
pyproject.toml.
Registered themes may be enabled through geovista.set_plot_theme(),
pyvista.set_plot_theme() or the PYVISTA_PLOT_THEME environment variable.
See Also#
pyvista.registered_themes()Enumeration of available registered themes.
ノート#
Added in version 0.6.0.
Classes#
Theme used for building the documentation. |
|
Default |
|
Common |
Functions#
|
Create an instance of the registered theme or dotted path theme class. |
Activate the previous plot theme. |
|
|
Set plotting parameters to a predefined theme. |
モジュール内容#
- class geovista.themes.GeoVistaDocumentTheme[ソース]#
Bases:
pyvista.plotting.themes.DocumentTheme,ThemeMixinTheme used for building the documentation.
Examples#
Make the
geovista_documenttheme the global default using an instance of the theme.>>> import pyvista as pv >>> from geovista.themes import GeoVistaDocumentTheme >>> pv.set_plot_theme(GeoVistaDocumentTheme())
Alternatively, enable the theme via its string name.
>>> pv.set_plot_theme("geovista_document")
ノート#
Added in version 0.6.0.
Documentation plotting theme for
geovista.
- class geovista.themes.GeoVistaTheme[ソース]#
Bases:
pyvista.plotting.themes.Theme,ThemeMixinDefault
geovistaplot theme.Examples#
Make the
geovistatheme the global default using an instance of the theme.>>> import pyvista as pv >>> from geovista.themes import GeoVistaTheme >>> pv.set_plot_theme(GeoVistaTheme())
Alternatively, enable the theme via its string name.
>>> pv.set_plot_theme("geovista")
ノート#
Added in version 0.6.0.
Default plotting theme for
geovista.
- class geovista.themes.ThemeMixin[ソース]#
Common
geovistaplotting theme property state.ノート
Added in version 0.6.0.
- geovista.themes.resolve_theme_name(name)[ソース]#
Create an instance of the registered theme or dotted path theme class.
- Parameters:
- name
str The name of the registered theme to lookup or the dotted path
package.module:ClassNametheme to be created.
- name
- Returns:
- Raises:
ValueErrorWhen name is an invalid dotted path specification or cannot be imported.
ノート
Added in version 0.6.0.
- geovista.themes.restore_plot_theme()[ソース]#
Activate the previous plot theme.
Provides a convenience to undo the last call to
geovista.themes.set_plot_theme(). Note that the entire call stack history is cached, so multiple calls togeovista.themes.set_plot_theme()may be undone in reverse order to restore a previous theme.When no cached theme is available, the current theme will remain active and
Noneis returned.ノート
Added in version 0.6.0.
- geovista.themes.set_plot_theme(theme, /, *, bootstrap=False)[ソース]#
Set plotting parameters to a predefined theme.
The enabled plot theme will be used by all plotters and rendering.
Requests to enable a plot theme will be ignored when the environment variable
GEOVISTA_DISABLE_PLOT_THEMEis set.Note that the replaced theme is cached and may be restored with
geovista.themes.restore_plot_theme().- Parameters:
- theme
Themeorstr The theme to apply, which may be either:
The string name of a registered theme. See
pyvista.registered_themes()for the available pyvista built-in and third-party entry-point group themes.A string
package.module:ClassNamedotted path to an importablepyvista.plotting.themes.Themesubclass.A
pyvista.plotting.themes.Themesubclass instance.
- bootstrap
bool, default=False When
True, theme configuration is skipped if the environment variablePYVISTA_PLOT_THEMEis set. Otherwise, the provided theme will be enabled regardless of that environment variable. This behaviour allows a pre-definedPYVISTA_PLOT_THEMEto take precedence.
- theme
- Returns:
boolTrueif the theme was successfully enabled, otherwiseFalse.
- Raises:
ValueErrorWhen theme is an invalid dotted path specification or cannot be imported.
参考
geovista.themes.restore_plot_theme()Reinstates the plot theme to the previous replaced theme.
pyvista.registered_themes()The list of available registered themes.
pyvista.plotting.themes.ThemeBase class for all themes. Subclasses with the class property
_default_nameare discoverable by pyvista.
ノート
Added in version 0.6.0.
Examples
Set the default
geovistatheme.>>> import geovista as gv >>> gv.set_plot_theme("geovista") True
Set the pyvista dark theme.
>>> gv.set_plot_theme("dark") True
Load a theme from an importable package module specified as a dotted path.
>>> gv.set_plot_theme("geovista.themes:GeoVistaTheme") True
Set the pyvista paraview theme.
>>> from pyvista import themes >>> gv.set_plot_theme(themes.ParaViewTheme()) True