spateo.plotting.static.three_d_plot.three_dims_plotter ====================================================== .. py:module:: spateo.plotting.static.three_d_plot.three_dims_plotter Functions --------- .. autoapisummary:: spateo.plotting.static.three_d_plot.three_dims_plotter._get_default_cmap spateo.plotting.static.three_d_plot.three_dims_plotter.create_plotter spateo.plotting.static.three_d_plot.three_dims_plotter._set_jupyter spateo.plotting.static.three_d_plot.three_dims_plotter.add_model spateo.plotting.static.three_d_plot.three_dims_plotter.add_str_legend spateo.plotting.static.three_d_plot.three_dims_plotter.add_num_legend spateo.plotting.static.three_d_plot.three_dims_plotter.add_legend spateo.plotting.static.three_d_plot.three_dims_plotter.add_outline spateo.plotting.static.three_d_plot.three_dims_plotter.add_text spateo.plotting.static.three_d_plot.three_dims_plotter.output_plotter spateo.plotting.static.three_d_plot.three_dims_plotter.save_plotter Module Contents --------------- .. py:function:: _get_default_cmap() .. py:function:: create_plotter(jupyter: bool = False, off_screen: bool = False, window_size: tuple = (512, 512), background: str = 'white', shape: Union[str, list, tuple] = (1, 1), show_axes: bool = True) -> pyvista.Plotter Create a plotting object to display pyvista/vtk model. :param jupyter: Whether to plot in jupyter notebook. :param off_screen: Renders off-screen when True. Useful for automated screenshots. :param window_size: Window size in pixels. The default window_size is ``[1024, 768]``. :param background: The background color of the window. :param shape: Number of sub-render windows inside the main window. By default, there is only one render window. * Specify two across with ``shape``=(2, 1) and a two by two grid with ``shape``=(2, 2). * ``shape`` Can also accept a string descriptor as shape. ``E.g.: shape="3|1" means 3 plots on the left and 1 on the right,`` ``E.g.: shape="4/2" means 4 plots on top and 2 at the bottom.`` :param show_axes: Whether to add a camera orientation widget to the active renderer. :returns: The plotting object to display pyvista/vtk model. :rtype: plotter .. py:function:: _set_jupyter(jupyter: Union[bool, Literal['trame', 'panel', 'none', 'static', 'html']] = False, off_screen: bool = False) .. py:function:: add_model(plotter: pyvista.Plotter, model: Union[pyvista.PolyData, pyvista.UnstructuredGrid, pyvista.MultiBlock, list], key: Union[str, list] = None, colormap: Optional[Union[str, list]] = None, ambient: Union[float, list] = 0.2, opacity: Union[float, list, numpy.ndarray] = 1.0, model_style: Union[Literal['points', 'surface', 'wireframe'], list] = 'surface', model_size: Union[float, list] = 3.0) Add model(s) to the plotter. :param plotter: The plotting object to display pyvista/vtk model. :param model: A reconstructed model. :param key: The key under which are the labels. :param colormap: Name of the Matplotlib colormap to use when mapping the scalars. When the colormap is None, use {key}_rgba to map the scalars, otherwise use the colormap to map scalars. :param ambient: When lighting is enabled, this is the amount of light in the range of 0 to 1 (default 0.0) that reaches the actor when not directed at the light source emitted from the viewer. :param opacity: Opacity of the model. If a single float value is given, it will be the global opacity of the model and uniformly applied everywhere, elif a numpy.ndarray with single float values is given, it will be the opacity of each point. - should be between 0 and 1. A string can also be specified to map the scalars range to a predefined opacity transfer function (options include: 'linear', 'linear_r', 'geom', 'geom_r'). :param model_style: Visualization style of the model. One of the following: * ``model_style = 'surface'``, * ``model_style = 'wireframe'``, * ``model_style = 'points'``. :param model_size: If ``model_style = 'points'``, point size of any nodes in the dataset plotted. If ``model_style = 'wireframe'``, thickness of lines. .. py:function:: add_str_legend(plotter: pyvista.Plotter, labels: numpy.ndarray, colors: numpy.ndarray, legend_size: Optional[Tuple] = None, legend_loc: Literal['upper right', 'upper left', 'lower left', 'lower right', 'center left', 'center right', 'lower center', 'upper center', 'center'] = 'lower right') Add a string legend to the plotter. :param plotter: The plotting object to display pyvista/vtk model. :param labels: Legend labels. :param colors: The colors corresponding to the legend labels. :param legend_size: The percentage (0 to 1) width and height of the window for the legend. For example (0.1, 0.1) would make the legend 10% the size of the entire figure window. If legend_size is None, legend_size will be adjusted adaptively. :param legend_loc: The location of the legend in the window. Available ``legend_loc`` are: * ``legend_loc = 'upper right'`` * ``legend_loc = 'upper left'`` * ``legend_loc = 'lower left'`` * ``legend_loc = 'lower right'`` * ``legend_loc = 'center left'`` * ``legend_loc = 'center right'`` * ``legend_loc = 'lower center'`` * ``legend_loc = 'upper center'`` * ``legend_loc = 'center'`` .. py:function:: add_num_legend(plotter: pyvista.Plotter, title: Optional[str] = '', title_font_size: Optional[Union[int, float]] = None, label_font_size: Optional[Union[int, float]] = None, font_color: str = 'black', font_family: Literal['times', 'courier', 'arial'] = 'arial', fmt='%.2e', n_labels: int = 5, legend_size: Union[tuple, list] = (0.1, 0.4), legend_loc: Union[tuple, list] = (0.85, 0.3), vertical: bool = True) Add a numeric legend (colorbar) to the plotter. :param plotter: The plotting object to display pyvista/vtk model. :param title: Title of the legend. Default '' which is rendered as an empty title. :param title_font_size: Sets the size of the title font. :param label_font_size: Sets the size of the label font. :param font_color: The color of the font. :param font_family: The font of the text. Available `font_family` are: * ``font_family = times`` * ``font_family = courier`` * ``font_family = arial`` :param fmt: printf format for labels. :param n_labels: Number of labels to use for the legend. :param legend_size: The percentage (0 to 1) width and height of the window for the legend. :param legend_loc: The location of the legend in the window. legend_loc[0]: The percentage (0 to 1) along the windows’s horizontal direction to place the bottom left corner of the legend. legend_loc[1]: The percentage (0 to 1) along the windows’s vertical direction to place the bottom left corner of the legend. :param vertical: Use vertical or horizontal legend. .. py:function:: add_legend(plotter: pyvista.Plotter, model: Union[pyvista.PolyData, pyvista.UnstructuredGrid, pyvista.MultiBlock], key: Optional[Union[str, list]] = None, colormap: Optional[Union[str, list]] = None, legend_size: Optional[Tuple] = None, legend_loc: Union[str, tuple, list] = None, title: Optional[str] = '', title_font_size: Optional[Union[int, float]] = None, label_font_size: Optional[Union[int, float]] = None, font_color: str = 'black', font_family: Literal['times', 'courier', 'arial'] = 'arial', fmt='%.2e', n_labels: int = 5, vertical: bool = True) Add a legend to the plotter. :param plotter: The plotting object to display pyvista/vtk model. :param model: A reconstructed model. :param key: The key under which are the legend labels. :param colormap: Name of the Matplotlib colormap to use when mapping the scalars. When the colormap is None, use {key}_rgba to map the scalars, otherwise use the colormap to map scalars. :param legend_size: The percentage (0 to 1) width and height of the window for the legend. :param legend_loc: The location of the legend in the window. :param title: Title of the legend. Default '' which is rendered as an empty title. :param title_font_size: Sets the size of the title font. Only available when colormap is not None. :param label_font_size: Sets the size of the label font. Only available when colormap is not None. :param font_color: The color of the font. Only available when colormap is not None. :param font_family: The font of the text. Only available when colormap is not None. Available `font_family` are: * ``font_family = times`` * ``font_family = courier`` * ``font_family = arial`` :param fmt: printf format for labels. Only available when colormap is not None. :param n_labels: Number of labels to use for the legend. Only available when colormap is not None. :param vertical: Use vertical or horizontal legend. Only available when colormap is not None. .. py:function:: add_outline(plotter: pyvista.Plotter, model: Union[pyvista.PolyData, pyvista.UnstructuredGrid, pyvista.MultiBlock], outline_width: float = 5.0, outline_color: Union[str, tuple] = 'black', show_labels: bool = True, font_size: int = 16, font_color: Union[str, tuple] = 'white', font_family: Literal['times', 'courier', 'arial'] = 'arial') Produce an outline of the full extent for the model. If labels is True, add the length, width and height information of the model to the outline. :param plotter: The plotting object to display pyvista/vtk model. :param model: A reconstructed model. :param outline_width: The width of the outline. :param outline_color: The color of the outline. :param show_labels: Whether to add the length, width and height information of the model to the outline. :param font_family: The font family of the text. Available `font_family` are: * ``font_family = times`` * ``font_family = courier`` * ``font_family = arial`` :param font_size: The size of the font. :param font_color: The color of the font. .. py:function:: add_text(plotter: pyvista.Plotter, text: str, font_family: Literal['times', 'courier', 'arial'] = 'arial', font_size: Union[int, float] = 15, font_color: Union[str, tuple, list] = 'black', text_loc: Literal['lower_left', 'lower_right', 'upper_left', 'upper_right', 'lower_edge', 'upper_edge', 'right_edge', 'left_edge'] = 'upper_left') Add text to the plotter. :param plotter: The plotting object to display pyvista/vtk model. :param text: The text to add the rendering. :param font_family: The font family of the text. Available `font_family` are: * ``font_family = times`` * ``font_family = courier`` * ``font_family = arial`` :param font_size: The size of the font. :param font_color: The color of the font. :param text_loc: The location of the text in the window. Available `text_loc` are: * ``text_loc = 'lower_left'`` * ``text_loc = 'lower_right'`` * ``text_loc = 'upper_left'`` * ``text_loc = 'upper_right'`` * ``text_loc = 'lower_edge'`` * ``text_loc = 'upper_edge'`` * ``text_loc = 'right_edge'`` * ``text_loc = 'left_edge'`` .. py:function:: output_plotter(plotter: pyvista.Plotter, filename: Optional[str] = None, view_up: tuple = (0.5, 0.5, 1), framerate: int = 15, jupyter: Union[bool, Literal['trame', 'panel', 'none', 'static', 'html']] = False) Output plotter as image, gif file or mp4 file. :param plotter: The plotting object to display pyvista/vtk model. :param filename: Filename of output file. Writer type is inferred from the extension of the filename. * Output an image file,please enter a filename ending with ``'.png', '.tif', '.tiff', '.bmp', '.jpeg', '.jpg', '.svg', '.eps', '.ps', '.pdf', '.tex'``. When ``jupyter=False``, if you want to save '.png' file, please ensure ``off_screen=True``. * Output a gif file, please enter a filename ending with ``.gif``. * Output a mp4 file, please enter a filename ending with ``.mp4``. :param view_up: The normal to the orbital plane. Only available when filename ending with ``.mp4`` or ``.gif``. :param framerate: Frames per second. Only available when filename ending with ``.mp4`` or ``.gif``. :param jupyter: Whether to plot in jupyter notebook. Available ``jupyter`` are: * ``'none'`` - Do not display in the notebook. * ``'trame'`` - Show a trame widget * ``'static'`` - Display a static figure. :returns: List of camera position, focal point, and view up. Returned only if filename is None or filename ending with ``'.png', '.tif', '.tiff', '.bmp', '.jpeg', '.jpg', '.svg', '.eps', '.ps', '.pdf', '.tex'``. img: Numpy array of the last image. Returned only if filename is None or filename ending with ``'.png', '.tif', '.tiff', '.bmp', '.jpeg', '.jpg', '.svg', '.eps', '.ps', '.pdf', '.tex'``. :rtype: cpo .. py:function:: save_plotter(plotter: pyvista.Plotter, filename: str) Save plotter as gltf file, html file, obj file or vtkjs file. :param plotter: The plotting object to display pyvista/vtk model. :param filename: The filename of the file where the plotter is saved. Writer type is inferred from the extension of the filename. * Output a gltf file, please enter a filename ending with ``.gltf``. * Output a html file, please enter a filename ending with ``.html``. * Output an obj file, please enter a filename ending with ``.obj``. * Output a vtkjs file, please enter a filename without format.