qcodes_loop.plots.qcmatplotlib¶
Live plotting in Jupyter notebooks using the nbagg backend and matplotlib
- class qcodes_loop.plots.qcmatplotlib.MatPlot(*args, figsize=None, interval=1, subplots=None, num=None, **kwargs)¶
Plot x/y lines or x/y/z heatmap data. The first trace may be included in the constructor, other traces can be added with MatPlot.add()
- Parameters:
*args – Sequence of data to plot. Each element will have its own subplot. An element can be a single array, or a sequence of arrays. In the latter case, all arrays will be plotted in the same subplot.
figsize (Tuple[float, float]) – (width, height) tuple in inches to pass to plt.figure. If not provided, figsize is determined from subplots shape
interval – period in seconds between update checks
subplots – either a sequence (args) or mapping (kwargs) to pass to plt.subplots. default is a single simple subplot (1, 1) you can use this to pass kwargs to the plt.figure constructor
num – integer or None specifies the index of the matplotlib figure window to use. If None then open a new window
**kwargs – passed along to MatPlot.add() to add the first data trace
- add_to_plot(use_offset: bool = False, **kwargs)¶
adds one trace to this MatPlot.
- Parameters:
use_offset – Whether or not ticks can have an offset
**kwargs – with the exceptions given in the notes below (mostly the data!), these are passed directly to the matplotlib plotting routine.
- Returns:
Plot handle for trace
Notes
The following special cases apply for kwargs that are not passed directly to the plotting routine.
subplot: the 1-based axes number to append to (default 1)
if kwargs include z, we will draw a heatmap (ax.pcolormesh) x, y, and z are passed as positional args to pcolormesh
without z we draw a scatter/lines plot (ax.plot) x, y, and fmt (if present) are passed as positional args
- clear(subplots=None, figsize=None)¶
Clears the plot window and removes all subplots and traces so that the window can be reused.
- static default_figsize(subplots)¶
Provides default figsize for given subplots. :param subplots: shape (nrows, ncols) of subplots :type subplots: Tuple[Int, Int]
- Returns:
- (width, height) of default figsize
for given subplot shape
- Return type:
Tuple[float, float]
- rescale_axis()¶
Rescale axis and units for axis that are in standard units i.e. V, s J … to m μ, m This scales units defined in BasePlot.standardunits only to avoid prefixes on combined or non standard units
- save(filename=None)¶
Save current plot to filename, by default to the location corresponding to the default title.
- Parameters:
filename (Optional[str]) – Location of the file
- tight_layout()¶
Perform a tight layout on the figure. A bit of additional spacing at the top is also added for the title.
- update_plot()¶
update the plot. The DataSets themselves have already been updated in update, here we just push the changes to the plot.