Extends Plolty python library for additional needed functionality.

Module Contents


plot_ex(figure_or_data[, show_link, link_text, ...])

Create a pyGSTi plotly graph locally, returning HTML & JS separately.


Similar to init_notebook_mode in plotly.offline.


Gets the custom pyGSTi version of plotly


DEFAULT_PLOTLY_TEMPLATE = "'none'", show_link=True, link_text='Export to', validate=True, resizable=False, lock_aspect_ratio=False, master=True, click_to_display=False, link_to=None, link_to_id=False, rel_figure_dir='figures')

Create a pyGSTi plotly graph locally, returning HTML & JS separately.


figure_or_dataplotly.graph_objs.Figure or .Data or dict or list

object that describes a Plotly graph. See for examples of graph descriptions.

show_linkbool, optional

display a link in the bottom-right corner of

link_textstr, optional

the text of export link

validatebool, optional

validate that all of the keys in the figure are valid? omit if you need to include extra, unnecessary keys in your figure.

resizablebool, optional

Make the plot resizable by including a “resize” event handler and any additional initialization.

lock_aspect_ratiobool, optional

Whether the aspect ratio of the plot should be allowed to change when it is sized based on it’s container.

masterbool, optional

Whether this plot represents the “master” of a group of plots, all of the others which are “slaves”. The relative sizing of the master of a group will determine the relative sizing of the slaves, rather than the slave’s containing element. Useful for preserving the size of the features in a group of plots that may be different overall sizes.

click_to_displaybool, optional

Whether the plot should be rendered immediately or whether a “click” icon should be shown instead, which must be clicked on to render the plot.

link_toNone or tuple of {“pdf”, “pkl”}

If not-None, the types of pre-rendered/computed versions of this plot that can be assumed to be present, and therefore linked to by additional items in the hover-over menu of the plotly plot.

link_to_idstr, optional

The base name (without extension) of the “.pdf” or “.pkl” files that are to be linked to by menu items. For example, if link_to equals (“pdf”,) and link_to_id equals “plot1234”, then a menu item linking to the file “plot1234.pdf” will be added to the renderd plot.

rel_figure_dirstr, optional

A relative path from the “current” path (the path of the generated html documents) to figure files. Usually something like “figures”.



With ‘html’ and ‘js’ keys separately specifying the HTML and javascript needed to embed the plot.

Similar to init_notebook_mode in plotly.offline.

The main difference is that this function loads the pyGSTi-customized plotly library when connected=False (which contains fixes relevant to pyGSTi plots).


connectedbool, optional

Whether an active internet connection should be assumed.



Gets the custom pyGSTi version of plotly