Autoplot – Quick plots for measurement reference¶
Autoplotting measurements
Function definition for simple plotting routine to be run at end of mesurement
-
stlabutils.autoplotter.
autoplot
(datafile, xlab, ylab, zlab=None, title='YOU SHOULD ADD A TITLE', caption='YOU SHOULD ADD A COMMENT', show=False, dpi=400, pl=None, cmap='RdBu_r', wbval=(0.1, 0.1), figdir=None, save=False, **kwargs)[source]¶ Autoplot function
Takes a data file handle (still open or recently closed) or a filename and plots the requested columns). Saves figure as a png alongside the original data file with the same name. As a precaution, if an exception is raised during the execution of this function, it will be caught internally so as not to interrupt the caller. It now doesn’t overwrite any previous figure. If a figure file already exists, it creates a new file with an index.
- Parameters
datafile (_io.TextIOWrapper or str) – Data file handle (can be open or closed) or data file name for reading
xlab (str) – Label for x axis data
ylab (str) – Label for y axis data
zlab (str or None, optional) – Label for z axis data. If set to none, a line plot is returned. If set to str a color plot is returned
title (str, optional) – Text label to be included in the title
caption (str, optional) – Comment included below figure
show (bool, optional) – Show the plot on screen (blocks execution until closed)
dpi (int, optional) – dpi for matplotlib savefig function
pl (list of str, optional) – If provided, is an stlabutilsmtx process list (in case processing is required on a 2d color plot). See
stlabutilsmtx
for detailscmap (str) – Matplotlib colormap string for 2D plots. By default ‘RdBu_r’. See https://matplotlib.org/tutorials/colors/colormaps.html for details
figdir (str) – Figure directory for the final plot
**kwargs – Other arguments to be passed to plotting function (plt.plot or plt.imshow)
- Returns
fig – Final figure that has been saved to file
- Return type
matplotlib.figure.Figure