pyprobe.plot module#

A module to contain plotting functions for PyProBE.

seaborn = <pyprobe.plot.SeabornWrapper object>#

A wrapped version of the seaborn package.

Requires the seaborn package to be installed as an optional dependency. You can install it with PyProBE by running pip install 'PyProBE-Data[seaborn]', or install it seperately with pip install seaborn.

This version of seaborn is modified to work with PyProBE Result objects. All functions from the original seaborn package are available in this version. Where seaborn functions accept a ‘data’ argument, a PyProBE Result object can be passed instead of a pandas DataFrame. For example:

from pyprobe.plot import seaborn as sns

result = cell.procedure['Sample']
sns.lineplot(data=result, x="x", y="y")
Other modifications include:
  • The ‘estimator’ argument is set to None by default in the lineplot function for

performance. This can be overridden by passing an estimator explicitly.

See the seaborn documentation for more information: https://seaborn.pydata.org/

class Plot(*args, **kwargs)#

Bases: object

A class for plotting result objects with plotly.

The Plot class is deprecated as a user facing class. It is kept for powering the backend of the dashboard. For user facing plotting, use the plot, hvplot or seaborn plotting integrations.”

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

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.