plotting.saving
plotting.saving
Saving matplotlib figures with per-context (poster/talk/paper) presets.
The presets are rcparams.rc_presets entries, not dicts of their own: a
context is just “these save.* rcParams, for this call”, which is what
rc_context already means.
Attributes¶
| Name | Description |
|---|---|
contexts |
Functions¶
| Name | Description |
|---|---|
| save_current_figure | Save the current matplotlib figure to a file. |
| save_figure | Save a matplotlib figure to a file. |
save_current_figure¶
plotting.saving.save_current_figure(
folder,
filename,
prepend_date=True,
**kwargs,
)Save the current matplotlib figure to a file.
Parameters¶
| Name | Type | Description | Default |
|---|---|---|---|
| folder | str or Path | The folder to save the figure in. | required |
| filename | str | The name of the file to save the figure as (without extension). | required |
| prepend_date | bool | Whether to prepend the current date and time to the filename. Defaults to True. | True |
| **kwargs | Additional keyword arguments forwarded to save_figure. | {} |
save_figure¶
plotting.saving.save_figure(
fig,
folder,
filename,
prepend_date=True,
move_old=True,
context=None,
modify_folder_path=True,
**kwargs,
)Save a matplotlib figure to a file.
Parameters¶
| Name | Type | Description | Default |
|---|---|---|---|
| fig | matplotlib.figure.Figure | The figure to save. | required |
| folder | str or Path | The folder to save the figure in. | required |
| filename | str | The name of the file to save the figure as (without extension). | required |
| prepend_date | bool | Whether to prepend the current date and time to the filename. Defaults to True. | True |
| move_old | bool | Whether to move old files with the same name to an “old” folder first. Defaults to True. | True |
| context | (poster, talk, paper) | Named rc_presets bundle of save.* overrides (dpi, transparency, padding) to apply for this call. | "poster" |
| modify_folder_path | bool | If True and context is given, append context to folder when it isn’t already the folder’s last component. Defaults to True. | True |
| **kwargs | Additional keyword arguments passed to fig.savefig. | {} |