cachai.utilities.chsave

cachai.utilities.chsave(name='figure', dir_path='images', pdf=True, img_dpi=300, pdf_dpi=200)[source]

Saves the current matplotlib figure as PNG and optionally PDF with customizable dpi (dots per inch).

Parameters
namestr

The name of the figure. The image is saved as “dir_path/name.png” (default: “figure”).

Other Parameters
dir_pathstr

Path to the directory where the image is saved. If it doesn’t exist, it will be created (default: “images”)

pdfbool

Whether to also save the image as a PDF.

img_dpiint

The dpi of the PNG image.

pdf_dpiint

The dpi of the PDF image.

Examples

import cachai.utilities as chu

plt.figure(figsize=(10,10))
plt.scatter([1,2,3],[1,4,9],color="magenta")

chu.chsave("my_plot")