scivianna.plotter_2d.polygon package

Submodules

scivianna.plotter_2d.polygon.bokeh module

class scivianna.plotter_2d.polygon.bokeh.Bokeh2DPolygonPlotter

Bases: Plotter2D

2D 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

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

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.

send_event(callback)
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, value_range: Tuple[float, float])

Displays or hide the color bar, if display, updates its range

Parameters:
  • display (bool) – Display or hides the color bar

  • value_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

scivianna.plotter_2d.polygon.matplotlib module

class scivianna.plotter_2d.polygon.matplotlib.Matplotlib2DPolygonPlotter

Bases: Plotter2D

2D 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

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) – Geometry data

  • 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, new_range: Tuple[float, float])

Displays or hide the color bar, if display, updates its range

Parameters:
  • display (bool) – Display or hides the color bar

  • new_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

Module contents