class documentation

class ShowInFolder:

View In Hierarchy

callable instance to save and show figures from matplotlib.

Saves figures to a folder 'figs-...' with incremental filenames allowing to conveniently view and compare these figures.

Each call of the instance saves the current matplotlib figure and switches the focus to the save folder by calling the open_path method.

Example:

>> import cma, matplotlib.pyplot as plt
>> show = cma.utilities.utils.ShowInline('01')  # use './figs-01' folder
>>
>> plt.plot([1,2,3])
>> show()  # save current plot with a unique name in figs-01 folder
>>         # and switch focus to the folder

Under macOS, open_path invokes Finder where the figures can be conveniently explored and compared using the space and up/down keys.

Method __call__ save current figure and show folder and/or image in notebook.
Method __init__ save figures to folder 'figs-' + name.
Method open_path Undocumented
Method show_in_notebook display last saved figure in notebook (doesn't work with pdf)
Class Variable folder_prefix Undocumented
Instance Variable format_string filename format string
Instance Variable kwargs kwargs to plt.savefig
Instance Variable number number of saved figures or id of last saved figure
Instance Variable path output folder path
Instance Variable type Undocumented
Instance Variable _last_saved Undocumented
def __call__(self, keep=True, show_in_notebook=False, show_in_folder=True, save=True, width_save=None, width_show=None, name=None):

save current figure and show folder and/or image in notebook.

Uses IPython.display.Image to show the image in the notebook.

def __init__(self, name, type='pdf', dpi=400, **kwargs):

save figures to folder 'figs-' + name.

pdf are smaller than png and not pixeliated. The type can be changed at any time be reassigning the type attribute.

dpi and kwargs are passed to plt.savefig.

def open_path(self):

Undocumented

def show_in_notebook(self, width=None, **kwargs_show):

display last saved figure in notebook (doesn't work with pdf)

folder_prefix: str =

Undocumented

format_string: str =

filename format string

kwargs =

kwargs to plt.savefig

number =

number of saved figures or id of last saved figure

path =

output folder path

type =

Undocumented

_last_saved =

Undocumented