pygsti.report.plotly_plot_ex

Extends Plolty python library for additional needed functionality.

Module Contents

Functions

plot_ex(figure_or_data, show_link=True, link_text='Export to plot.ly', 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.

init_notebook_mode_ex(connected=False)

Similar to init_notebook_mode in plotly.offline.

format_plotlylib_inclusion_js()

Gets the custom pyGSTi version of plotly

Attributes

DEFAULT_PLOTLY_TEMPLATE

default

pygsti.report.plotly_plot_ex.DEFAULT_PLOTLY_TEMPLATE = none
pygsti.report.plotly_plot_ex.default
pygsti.report.plotly_plot_ex.plot_ex(figure_or_data, show_link=True, link_text='Export to plot.ly', 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.

Parameters
  • figure_or_data (plotly.graph_objs.Figure or Data or dict or list) – object that describes a Plotly graph. See https://plot.ly/python/ for examples of graph descriptions.

  • show_link (bool, optional) – display a link in the bottom-right corner of

  • link_text (str, optional) – the text of export link

  • validate (bool, optional) – validate that all of the keys in the figure are valid? omit if you need to include extra, unnecessary keys in your figure.

  • resizable (bool, optional) – Make the plot resizable by including a “resize” event handler and any additional initialization.

  • lock_aspect_ratio (bool, optional) – Whether the aspect ratio of the plot should be allowed to change when it is sized based on it’s container.

  • master (bool, 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_display (bool, 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_to (None 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_id (str, 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_dir (str, optional) – A relative path from the “current” path (the path of the generated html documents) to figure files. Usually something like “figures”.

Returns

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

pygsti.report.plotly_plot_ex.init_notebook_mode_ex(connected=False)

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).

Parameters

connected (bool, optional) – Whether an active internet connection should be assumed.

Returns

str

pygsti.report.plotly_plot_ex.format_plotlylib_inclusion_js()

Gets the custom pyGSTi version of plotly

Returns

str