pyprobe.plot module#

A module to contain plotting functions for PyProBE.

class Plot(layout=Layout({'height': 600, 'legend': {'font': {'size': 14}}, 'template': '...', 'title': {'font': {'size': 18}}, 'width': 800, 'xaxis': {'tickfont': {'size': 14}, 'title': {'font': {'size': 18}}}, 'yaxis': {'tickfont': {'size': 14}, 'title': {'font': {'size': 18}}}}))#

Bases: object

A class for plotting result objects with plotly.

Parameters:

layout (go.Layout) – The plotly layout to use.

title_font_size = 18#
axis_font_size = 14#
default_layout = Layout({     'height': 600,     'legend': {'font': {'size': 14}},     'template': '...',     'title': {'font': {'size': 18}},     'width': 800,     'xaxis': {'tickfont': {'size': 14}, 'title': {'font': {'size': 18}}},     'yaxis': {'tickfont': {'size': 14}, 'title': {'font': {'size': 18}}} })#
show()#

Show the plot.

Return type:

None

show_image()#

Show the plot as an image.

Return type:

None

add_line(result, x, y, secondary_y=None, color=None, label=None, dash='solid', showlegend=True)#

Add a line to the plot.

Parameters:
  • result (Result) – The result object.

  • x (str) – The x-axis dataframe column.

  • y (str) – The y-axis dataframe column.

  • secondary_y (str) – The secondary y-axis dataframe column.

  • color (str) – The color of the line.

  • label (str) – The label of the line.

  • dash (str) – The dash style of the line. E.g. “dash”, “dot”, “dashdot”.

  • showlegend (bool) – Whether to show the legend.

Return type:

Plot

add_colorscaled_line(result, x, y, color_by, colormap='viridis')#

Add a line to the plot colored continuously by a column.

Parameters:
  • result (Result) – The result object.

  • x (str) – The x-axis column.

  • y (str) – The y-axis column.

  • color_by (str) – The column to color by.

  • colormap (str) – The colormap to use.

Return type:

Plot

static make_colorscale(points, colormap='viridis')#

Create a colorscale across discrete points.

Parameters:
  • colormap (str) – The colormap to use.

  • points (NDArray) – An array of colors to generate colors for.

Return type:

List[str]

add_colorbar(color_bounds, color_by, colormap='viridis')#

Add a colorbar to the plot.

Parameters:
  • color_bounds (NDArray[np.float64]) – The bounds of the color scale.

  • color_by (str) – The column to color by.

  • colormap (str) – The colormap to use.

Return type:

Plot

property x_range: list[float]#

Return the x-axis range with a buffer.

property y_range: list[float]#

Return the y-axis range with a buffer.

property y2_range: list[float]#

Return the secondary y-axis range with a buffer.

property fig: Figure#

Return the plotly figure.