scivianna.plotter_2d.grid package
Submodules
scivianna.plotter_2d.grid.bokeh module
- class scivianna.plotter_2d.grid.bokeh.Bokeh2DGridPlotter
Bases:
Plotter2D2D geometry plotter based on the bokeh python module
- dim_hovered_cell = True
Sets the hovered cell opacity to 0.6
- display_borders(display: bool)
Display or hides the figure borders and axis
- Parameters:
display (bool) – Display if true, hides otherwise
- display_edges = True
Display grid cells edges
- export(file_name: str, title='Bokeh 2D plot')
Exports the plot in a file
- Parameters:
file_name (str) – Export file path
- get_resolution() Tuple[float, float]
Returns the current plot resolution to display. For resolution based codes, it will be replaced by the value present in the gui
- Returns:
Resolution if possible, else (None, None)
- Return type:
Tuple[float, float]
- make_panel() Viewable
Makes the Holoviz panel viewable displayed in the web app.
- Returns:
Displayed viewable
- Return type:
pn.viewable.Viewable
- on_mouse_move(_)
Callback called when the mouse is moved. The mouse location in the grid is saved, and an update is requested at the current location after a timeout.
- Parameters:
_ (Any) – Calling event
- plot_2d_frame(data: Data2D)
Adds a new plot to the figure from a set of polygons
- Parameters:
data (Data2D) – Data2D object containing the geometry to plot
- provide_on_clic_callback(callback: Callable)
Stores a function to call everytime the user clics on the plot. Functions arguments are location, cell_id.
- Parameters:
callback (Callable) – Function to call.
- provide_on_mouse_move_callback(callback: Callable)
Stores a function to call everytime the user moves the mouse on the plot. Functions arguments are location, cell_id.
- Parameters:
callback (Callable) – Function to call.
- reset_hover()
- send_event(callback)
Calling the callback to update the position and current cell_id to the layout
- Parameters:
callback (function) – Function to call
- set_axes(u: Tuple[float, float, float], v: Tuple[float, float, float], w: float)
Stores the u v axes of the current plot
- Parameters:
u (Tuple[float, float, float]) – Horizontal axis direction vector
v (Tuple[float, float, float]) – Vertical axis direction vector
w (float) – Normal vector coordinate
- set_color_map(color_map_name: str)
Sets the colorbar color map name
- Parameters:
color_map_name (str) – Color map name
- update_2d_frame(data: Data2D)
Updates plot to the figure
- Parameters:
data (Data2D) – Data2D object containing the data to update
- update_colorbar(display: bool, range: Tuple[float, float])
Displays or hide the color bar, if display, updates its range
- Parameters:
display (bool) – Display or hides the color bar
range (Tuple[float, float]) – New colormap range
- update_colors(data: Data2D)
Updates the colors of the displayed polygons
- Parameters:
data (Data2D) – Data2D object containing the data to update
- update_plot_after_mouse_move(i: int, j: int)
Updates the plot after changing the cell at location (i, j) to 0.6. The update is only done if the mouse is currently at (i, j)
- Parameters:
i (int) – U coordinate
j (int) – V coordinate
scivianna.plotter_2d.grid.grid_tools module
- scivianna.plotter_2d.grid.grid_tools.get_grids(data: Data2D, display_edges: bool) Tuple[ndarray, ndarray, ndarray, ndarray]
Provides 2D grids and color 3D grid from a Data2D, darkens the edges if requested
- Parameters:
data (Data2D) – Data2D to display
display_edges (bool) – Darken edges
- Returns:
Bokeh readable 2D image, 3D color grid, id grid, value grid
- Return type:
Tuple[np.ndarray, np.ndarray, np.ndarray, np.ndarray]
scivianna.plotter_2d.grid.matplotlib module
- class scivianna.plotter_2d.grid.matplotlib.Matplotlib2DGridPlotter
Bases:
Plotter2D2D geometry plotter based on the bokeh python module
- display_borders(display: bool)
Display or hides the figure borders and axis
- Parameters:
display (bool) – Display if true, hides otherwise
- display_edges = False
Display grid cells edges
- export(file_name: str, title='Bokeh 2D plot')
Exports the plot in a file
- Parameters:
file_name (str) – Export file path
- get_resolution() Tuple[float, float]
Returns the current plot resolution to display. For resolution based codes, it will be replaced by the value present in the gui
- Returns:
Resolution if possible, else (None, None)
- Return type:
Tuple[float, float]
- make_panel() Viewable
Makes the Holoviz panel viewable displayed in the web app.
- Returns:
Displayed viewable
- Return type:
pn.viewable.Viewable
- plot_2d_frame(data: Data2D)
Adds a new plot to the figure from a set of polygons
- Parameters:
data (Data2D) – Data2D object containing the geometry to plot
- plot_2d_frame_in_axes(data: Data2D, axes: Axes, plot_options: Dict[str, Any] = {})
Adds a new plot to the figure from a set of polygons
- Parameters:
data (Data2D) – Data2D object containing the geometry to plot
axes (matplotlib.axes.Axes) – Axes in which plot the figure
plot_options (Dict[str, Any])) – Color options to be passed on to the actual plot function, such as edgecolor, facecolor, linewidth, markersize, alpha.
- set_axes(u: Tuple[float, float, float], v: Tuple[float, float, float], w: float)
Stores the u v axes of the current plot
- Parameters:
u (Tuple[float, float, float]) – Horizontal axis direction vector
v (Tuple[float, float, float]) – Vertical axis direction vector
w (float) – Normal vector coordinate
- set_color_map(color_map_name: str)
Sets the colorbar color map name
- Parameters:
color_map_name (str) – Color map name
- update_2d_frame(data: Data2D)
Updates plot to the figure
- Parameters:
data (Data2D) – Data2D object containing the data to update
- update_colorbar(display: bool, range: Tuple[float, float])
Displays or hide the color bar, if display, updates its range
- Parameters:
display (bool) – Display or hides the color bar
range (Tuple[float, float]) – New colormap range