texplot.show_or_save_plot#
- texplot.show_or_save_plot(plt, filename=None, default_filename=None, transparent_background=True, bbox_extra_artists=None, dpi=200, bbox_inches='tight', show_and_save=False, verbose=False)#
Show and/or save plot.
- Parameters:
- filenamestr or bool, default=None
If False, the plot is neither shown nor saved. If True or None, the plot is shown. If string, the plot is saved instead, where the filename is the given string. If the filename contains no file extension, the plot is saved as both
svg
andpdf
format. If the filename contains no directory path, the plot is saved in the current directory.- default_filenamestr, default=None
If the plot cannot be shown (such as when no graphical backend exists), the plot is saved instead with the default filename.
- transparent_backgroundbool, default=True
If True, the figure and axes backgrounds will be rendered transparent in saved file. This only works for the file formats that support the alpha channel, such as
svg
,pdf
, andpng
files.- bbox_extra_artistlist, default=None
A list of extra artists to pass to the renderer.
- dpiint, default=200
Dots per inch for rendering plots.
- bbox_inches: str, default=’tight’
Bbox in inches.
- show_and_savebool, default=False
By default, the plot is either shown xor saved. But when this argument is True, the plot is forced to both be shown and saved.
- verbosebool, default=False
If True, the fullpath filename of the saved plot is printed.
Notes
The
filename
argument determines that whether the plot should be shown of saved. However, there the following exceptions are made:If
show_and_save
is enabled, plot is both shown and saved.If no graphical beckend exists, it the plot is saved instead of being shown, even of it was not intended to be saved.
If the environment is Jupyter notebook, the plot is always shown, even if it was not intended to be shown. If a filename is given, it is both shown and saved.