| 1 |
"""Plotting routines.""" |
| 2 |
|
| 3 |
from __future__ import annotations |
| 4 |
|
| 5 |
# Magic vtk imports needed to make LaTeX rendering work. See https://discourse.vtk.org/t/how-to-check-if-mathtext-is-supported-without-importing-all-of-vtk/16038 |
| 6 |
# isort: off |
| 7 |
import vtkmodules.vtkRenderingFreeType # noqa: F401, TID251 |
| 8 |
import vtkmodules.vtkRenderingMatplotlib # noqa: F401, TID251 |
| 9 |
# isort: on |
| 10 |
|
| 11 |
from pyvista import MAX_N_COLOR_BARS as MAX_N_COLOR_BARS |
| 12 |
from pyvista._plot import plot as plot |
| 13 |
|
| 14 |
from ._property import Property as Property |
| 15 |
from ._typing import CameraPositionOptions as CameraPositionOptions |
| 16 |
from ._typing import Chart as Chart |
| 17 |
from ._typing import ColorLike as ColorLike |
| 18 |
from .actor import Actor as Actor |
| 19 |
from .actor_properties import ActorProperties as ActorProperties |
| 20 |
from .affine_widget import AffineWidget3D as AffineWidget3D |
| 21 |
from .axes import Axes as Axes |
| 22 |
from .axes_actor import AxesActor as AxesActor |
| 23 |
from .axes_assembly import AxesAssembly as AxesAssembly |
| 24 |
from .axes_assembly import AxesAssemblySymmetric as AxesAssemblySymmetric |
| 25 |
from .axes_assembly import PlanesAssembly as PlanesAssembly |
| 26 |
from .camera import Camera as Camera |
| 27 |
from .charts import Chart2D as Chart2D |
| 28 |
from .charts import ChartBox as ChartBox |
| 29 |
from .charts import ChartMPL as ChartMPL |
| 30 |
from .charts import ChartPie as ChartPie |
| 31 |
from .colors import PARAVIEW_BACKGROUND as PARAVIEW_BACKGROUND |
| 32 |
from .colors import Color as Color |
| 33 |
from .colors import __getattr__ # noqa: F401 |
| 34 |
from .colors import color_char_to_word as color_char_to_word |
| 35 |
from .colors import get_cmap_safe as get_cmap_safe |
| 36 |
from .colors import hex_colors as hex_colors |
| 37 |
from .component_registry import ComponentRegistration as ComponentRegistration |
| 38 |
from .component_registry import PlotterComponent as PlotterComponent |
| 39 |
from .component_registry import register_plotter_component as register_plotter_component |
| 40 |
from .component_registry import registered_plotter_components as registered_plotter_components |
| 41 |
from .component_registry import unregister_plotter_component as unregister_plotter_component |
| 42 |
from .composite_mapper import BlockAttributes as BlockAttributes |
| 43 |
from .composite_mapper import CompositeAttributes as CompositeAttributes |
| 44 |
from .composite_mapper import CompositePolyDataMapper as CompositePolyDataMapper |
| 45 |
from .cube_axes_actor import CubeAxesActor as CubeAxesActor |
| 46 |
from .errors import InvalidCameraError as InvalidCameraError |
| 47 |
from .errors import RenderWindowUnavailable as RenderWindowUnavailable |
| 48 |
from .follower import Follower as Follower |
| 49 |
from .helpers import plot_arrows as plot_arrows |
| 50 |
from .helpers import plot_compare_four as plot_compare_four |
| 51 |
from .interactor_style_registry import register_interactor_style as register_interactor_style |
| 52 |
from .lights import Light as Light |
| 53 |
from .lookup_table import LookupTable as LookupTable |
| 54 |
from .mapper import DataSetMapper as DataSetMapper |
| 55 |
from .mapper import FixedPointVolumeRayCastMapper as FixedPointVolumeRayCastMapper |
| 56 |
from .mapper import GPUVolumeRayCastMapper as GPUVolumeRayCastMapper |
| 57 |
from .mapper import OpenGLGPUVolumeRayCastMapper as OpenGLGPUVolumeRayCastMapper |
| 58 |
from .mapper import PointGaussianMapper as PointGaussianMapper |
| 59 |
from .mapper import SmartVolumeMapper as SmartVolumeMapper |
| 60 |
from .mapper import UnstructuredGridVolumeRayCastMapper as UnstructuredGridVolumeRayCastMapper |
| 61 |
from .opts import PointSpriteShape as PointSpriteShape |
| 62 |
from .opts import ShaderType as ShaderType |
| 63 |
from .picking import PickingComponent as PickingComponent |
| 64 |
from .plotter import _ALL_PLOTTERS as _ALL_PLOTTERS |
| 65 |
from .plotter import BasePlotter as BasePlotter |
| 66 |
from .plotter import Plotter as Plotter |
| 67 |
from .plotter import close_all as close_all |
| 68 |
from .prop3d import Prop3D as Prop3D |
| 69 |
from .render_window_interactor import RenderWindowInteractor as RenderWindowInteractor |
| 70 |
from .render_window_interactor import Timer as Timer |
| 71 |
from .renderer import CameraPosition as CameraPosition |
| 72 |
from .renderer import Renderer as Renderer |
| 73 |
from .renderer import scale_point as scale_point |
| 74 |
from .text import CornerAnnotation as CornerAnnotation |
| 75 |
from .text import Label as Label |
| 76 |
from .text import Text as Text |
| 77 |
from .text import TextProperty as TextProperty |
| 78 |
from .texture import Texture as Texture |
| 79 |
from .texture import image_to_texture as image_to_texture |
| 80 |
from .texture import numpy_to_texture as numpy_to_texture |
| 81 |
from .theme_registry import ThemeRegistration as ThemeRegistration |
| 82 |
from .theme_registry import registered_themes as registered_themes |
| 83 |
from .themes import DocumentTheme as _GlobalTheme |
| 84 |
from .themes import _set_plot_theme_from_env as _set_plot_theme_from_env |
| 85 |
from .themes import load_theme as load_theme |
| 86 |
from .themes import set_plot_theme as set_plot_theme |
| 87 |
from .tools import FONTS as FONTS |
| 88 |
from .tools import check_math_text_support as check_math_text_support |
| 89 |
from .tools import check_matplotlib_vtk_compatibility as check_matplotlib_vtk_compatibility |
| 90 |
from .tools import create_axes_marker as create_axes_marker |
| 91 |
from .tools import create_axes_orientation_box as create_axes_orientation_box |
| 92 |
from .tools import normalize as normalize |
| 93 |
from .tools import opacity_transfer_function as opacity_transfer_function |
| 94 |
from .tools import parse_font_family as parse_font_family |
| 95 |
from .tools import system_supports_plotting as system_supports_plotting |
| 96 |
from .utilities import * |
| 97 |
from .utilities.sphinx_gallery import _get_sg_image_scraper as _get_sg_image_scraper |
| 98 |
from .volume import Volume as Volume |
| 99 |
from .volume_property import VolumeProperty as VolumeProperty |
| 100 |
from .widgets import WidgetComponent as WidgetComponent |
| 101 |
|
| 102 |
|
| 103 |
class QtDeprecationError(Exception): # numpydoc ignore=PR01 |
| 104 |
"""Deprecation Error for features that moved to `pyvistaqt`.""" |
| 105 |
|
| 106 |
message = """`{}` has moved to pyvistaqt. |
| 107 |
You can install this from PyPI with: `pip install pyvistaqt` |
| 108 |
Then import it via: `from pyvistaqt import {}` |
| 109 |
`{}` is no longer accessible by `pyvista.{}` |
| 110 |
See https://github.com/pyvista/pyvistaqt |
| 111 |
""" |
| 112 |
|
| 113 |
def __init__(self, feature_name: str) -> None: |
| 114 |
"""Empty init.""" |
| 115 |
Exception.__init__(self, self.message.format(*[feature_name] * 4)) |
| 116 |
|
| 117 |
|
| 118 |
class BackgroundPlotter: # numpydoc ignore=PR01 |
| 119 |
"""This class has been moved to pyvistaqt.""" # noqa: D404 |
| 120 |
|
| 121 |
def __init__(self, *args, **kwargs) -> None: # noqa: ARG002 |
| 122 |
"""Empty init.""" |
| 123 |
msg = 'BackgroundPlotter' |
| 124 |
raise QtDeprecationError(msg) |
| 125 |
|
| 126 |
|
| 127 |
class QtInteractor: # numpydoc ignore=PR01 |
| 128 |
"""This class has been moved to pyvistaqt.""" # noqa: D404 |
| 129 |
|
| 130 |
def __init__(self, *args, **kwargs) -> None: # noqa: ARG002 |
| 131 |
"""Empty init.""" |
| 132 |
msg = 'QtInteractor' |
| 133 |
raise QtDeprecationError(msg) |
| 134 |
|
| 135 |
|
| 136 |
global_theme: _GlobalTheme = _GlobalTheme() |