pysdic.PointCloud.visualize#
- PointCloud.visualize(point_color=None, point_size=None, point_opacity=None, point_mask=None, property=None, property_axis=None, property_clim=None, property_cmap=None, property_below_color=None, property_above_color=None, bar_title=None, bar_width=None, bar_height=None, bar_position_x=None, bar_position_y=None, bar_title_font_family=None, bar_title_font_size=None, bar_label_font_size=None, bar_title_color=None, bar_title_bold=False, bar_vertical=True, bar_interactive=False, show_bar=True, title=None, title_color=None, title_font_family=None, title_font_size=None, show_title=True, bounds=None, bounds_grid=None, bounds_ticks=None, bounds_location=None, bounds_color=None, bounds_font_size=None, bounds_font_family=None, bounds_bold=False, bounds_fmt=None, bounds_title_x='X Axis', bounds_title_y='Y Axis', bounds_title_z='Z Axis', bounds_n_xlabels=5, bounds_n_ylabels=5, bounds_n_zlabels=5, bounds_show_xaxis=True, bounds_show_yaxis=True, bounds_show_zaxis=True, bounds_show_xlabels=True, bounds_show_ylabels=True, bounds_show_zlabels=True, show_bounds=True, camera_position=None, camera_focal_point=None, camera_view_up=None, screenshot_path=None)[source]#
Visualize the point cloud using PyVista (only for \(E \leq 3\) point clouds).
Note
For 1D or 2D point clouds, the points are visualized in a 3D space by adding zero coordinates for the missing dimensions.
Only finite points (not NaN or Inf) are visualized.
See also
PyVista Documentation for more details on visualization options.
- Parameters:
point_color (Union[
str, Tuple[Real, Real, Real]], optional) – The color of the points in the visualization. Can be a string representing a color name (e.g.,"red"), or an RGB tuple or hex string. This parameter is ignored ifpropertyis provided.point_size (Real, optional) – The size of the points in the visualization. Must be a positive value if provided. Default is set by PyVista to
5.0.point_opacity (Real, optional) – The opacity of the points in the visualization. Must be between
0.0(fully transparent) and1.0(fully opaque) if provided. Default is set by PyVista to1.0.point_mask (Optional[ArrayLike], optional) – A boolean NumPy array of shape \((N_p,)\) where \(N_p\) is the number of points in the point cloud. Points corresponding to True values in the mask are visualized, while points corresponding to False values are not visualized. If
None, all finite points are visualized.property (Union[
str, ArrayLike], optional) – The property to use for coloring the points. Can be a string representing the property key of a property stored in the point cloud, or a NumPy array of shape \((N_p,)\) or \((N_p, A)\) representing a property to use for coloring the points. Note that if a string key is provided, the corresponding property must exist in the point cloud.property_axis (Optional[Integral], optional) – The axis to use when
propertycontains multiple attributes per point (shape \((N_p, A)\)). IfNone, the magnitude of the property vector is used for coloring. By default,None.property_clim (Optional[Tuple[Real, Real]], optional) – The color limits (min, max) for the property values when
propertyis provided. IfNone, the color limits are determined automatically. Default isNone.property_cmap (Union[
str,matplotlib.colors.Colormap], optional) – The colormap to use for coloring the points based on the property values. Can be a string representing a Matplotlib colormap or a Matplotlib Colormap object. IfNone, the default colormap"viridis"is used by Matplotlib.property_below_color (Union[
str, Tuple[Real, Real, Real]], optional) – The color to use for points with property values below the minimum color limit whenproperty_climis provided. Can be a string representing a color name (e.g.,"blue"), or an RGB tuple or hex string. IfNone, the default below color is set to the minimum color of the colormap.property_above_color (Union[
str, Tuple[Real, Real, Real]], optional) – The color to use for points with property values above the maximum color limit whenproperty_climis provided. Can be a string representing a color name (e.g.,"red"), or an RGB tuple or hex string. IfNone, the default above color is set to the maximum color of the colormap.bar_title (Optional[
str], optional) – The title of the color bar whenpropertyis provided. IfNone, no title is displayed.bar_width (Optional[Real], optional) – The width of the color bar as a fraction of the window width. Must be between
0.0and1.0if provided.bar_height (Optional[Real], optional) – The height of the color bar as a fraction of the window height. Must be between
0.0and1.0if provided.Optional[Real] (bar_position_x) – The x position of the color bar as a fraction of the window width. Must be between
0.0and1.0if provided.optional – The x position of the color bar as a fraction of the window width. Must be between
0.0and1.0if provided.bar_position_y (Optional[Real], optional) – The y position of the color bar as a fraction of the window height. Must be between
0.0and1.0if provided.bar_title_font_family (Optional[
str], optional) – The font type of the color bar title between"arial","courier", and"times".bar_title_font_size (Optional[Integral], optional) – The font size of the color bar title.
bar_label_font_size (Optional[Integral], optional) – The font size of the color bar labels.
bar_title_color (Union[
str, Tuple[Real, Real, Real]], optional) – The color of the color bar title text. Can be a string representing a color name (e.g.,"black"), or an RGB tuple or hex string.bar_title_bold (
bool, optional) – Whether to display the color bar title in bold font. Default isFalse.bar_vertical (
bool, optional) – Whether to display the color bar vertically. IfFalse, the color bar is displayed horizontally. Default isTrue.bar_interactive (
bool, optional) – IfTrue, enables interactive mode for the color bar in PyVista. Default isFalse.show_bar (
bool, optional) – Whether to show the color bar in the visualization. Default isTrue.title (Optional[
str], optional) – The title of the visualization window.title_color (Union[
str, Tuple[Real, Real, Real]], optional) – The color of the title text. Can be a string representing a color name (e.g.,"blue"), or an RGB tuple or hex string.title_font_family (Optional[
str], optional) – The font type of the title between"arial","courier", and"times".title_font_size (Optional[Integral], optional) – The font size of the title.
show_title (
bool, optional) – Whether to show the title in the visualization. Default isTrue.bounds (Optional[Tuple[Real, Real, Real, Real, Real, Real]], optional) – The bounds of the axes in the format (
min_x,max_x,min_y,max_y,min_z,max_z). IfNone, the bounds are determined automatically.bounds_grid (Optional[
str], optional) – Add grid lines to the backface (True, ‘back’, or ‘backface’) or to the frontface (‘front’, ‘frontface’) of the axes actor.bounds_ticks (Optional[
str], optional) – Set how the ticks are drawn on the axes grid. Options include: ‘inside’, ‘outside’, ‘both’.bounds_location (Optional[
str], optional) – Set how the axes are drawn: either static (‘all’), closest triad (‘front’, ‘closest’, ‘default’), furthest triad (‘back’, ‘furthest’), static closest to the origin (‘origin’), or outer edges (‘outer’) in relation to the camera position.bounds_color (Union[
str, Tuple[Real, Real, Real]], optional) – The color of the axes bounds. Can be a string representing a color name (e.g.,"black"), or an RGB tuple or hex string.bounds_font_size (Optional[Integral], optional) – The font size of the axes bounds.
bounds_font_family (Optional[
str], optional) – The font type of the axes bounds between"arial","courier", and"times".bounds_bold (
bool, optional) – Whether to display the axes bounds in bold font. Default isFalse.bounds_fmt (Optional[
str], optional) – The format string for the axes bounds labels (e.g.,"{:.2f}"for 2 decimal places).bounds_title_x (
str, optional) – The title for the x-axis bounds. Default is"X Axis".bounds_title_y (
str, optional) – The title for the y-axis bounds. Default is"Y Axis".bounds_title_z (
str, optional) – The title for the z-axis bounds. Default is"Z Axis".bounds_n_xlabels (Integral, optional) – The number of labels to display on the x-axis bounds. Default is
5.bounds_n_ylabels (Integral, optional) – The number of labels to display on the y-axis bounds. Default is
5.bounds_n_zlabels (Integral, optional) – The number of labels to display on the z-axis bounds. Default is
5.bounds_show_xaxis (
bool, optional) – Whether to show the x-axis in the bounds. Default isTrue.bounds_show_yaxis (
bool, optional) – Whether to show the y-axis in the bounds. Default isTrue.bounds_show_zaxis (
bool, optional) – Whether to show the z-axis in the bounds. Default isTrue.bounds_show_xlabels (
bool, optional) – Whether to show the x-axis labels in the bounds. Default isTrue.bounds_show_ylabels (
bool, optional) – Whether to show the y-axis labels in the bounds. Default isTrue.bounds_show_zlabels (
bool, optional) – Whether to show the z-axis labels in the bounds. Default isTrue.show_bounds (
bool, optional) – Whether to show the axes bounds in the visualization. Default isTrue.camera_position (Optional[ArrayLike], optional) – The position of the camera in the 3D space as a NumPy array of shape \((3,)\).
camera_focal_point (Optional[ArrayLike], optional) – The focal point of the camera in the 3D space as a NumPy array of shape \((3,)\).
camera_view_up (Optional[ArrayLike], optional) – The view up vector of the camera as a NumPy array of shape \((3,)\).
screenshot_path (Optional[
str], optional) – The file path to save a screenshot of the visualization. IfNone, no screenshot is saved.bar_position_x (Real | None)
- Return type:
None
Examples
Create a
PointCloudfrom a random NumPy array.1import numpy as np 2from pysdic import PointCloud 3 4# Create a random point cloud with 100 points 5points_array = np.random.rand(100, 3) 6point_cloud = PointCloud.from_array(points_array)
Visualize the point cloud using the visualize method.
1point_cloud.visualize(point_color='red', point_size=10)