A few conveniences for working with matplotlib.
Latest release 20241122:
- FigureSize: fix field factories.
- print_figure: wire a .png extension for the temp image.
axes(figure=None, ax=None, **fig_kw) -> matplotlib.axes._axes.Axes
Return a set of Axes.
Parameters:
figure: optionalFigurefrom which to obtain theAxesor an(x,y)figure size or an(x,y,dpi)figure sizeax: optionalAxesor axes index
If ax is already an Axes it is returned unchanged.
Otherwise ax should be the index of a set of axes,
default 0.
If figure is a Figure, ax is used to select one of its
sets of axes.
Otherwise a Figure is created and a set of axes is selected.
The default figure size comes from the FigureSize defaults.
The figure positional parameter may be supplied
as a 2-tuple (fig_dx,fig_dy) to override the default size
or as a 3-tuple (fig_dx,fig_dy,dpi) to override the default size and dpi,
or as a FigureSze.
Class FigureSize
Specifications for a Figure's dimensions.
FigureSize.Figure(self, **kw):
Return a new Figure of this size.
It will have no subplots.
print_figure(figure_or_ax, imgformat=None, file=None)
Print figure_or_ax to a file.
Parameters:
figure_or_ax: amatplotlib.figure.Figureor an object with a.figureattribute such as a set ofAxesimgformat: optional output format; if omitted use'sixel'iffileis a terminal, otherwise'png'file: the output file, defaultsys.stdout
remove_decorations(figure_or_ax: Union[matplotlib.figure.Figure, matplotlib.axes._axes.Axes])
Remove all decorations from a Figure or Axes instance,
intended for making bare plots such as a tile in GUI.
Presently this removes:
- axes markings and legend from each axis
- the padding from all the figure subplots
save_figure(figure_or_ax, imgpath: str, force=False)
Save a Figure to the file imgpath.
Parameters:
figure_or_ax: amatplotlib.figure.Figureor an object with a.figureattribute such as a set ofAxesimgpath: the filesystem path to which to save the imageforce: optional flag, defaultFalse: if true theimgpathwill be written to even if it exists
saved_figure(figure_or_ax, dir=None, ext=None)
Context manager to save a Figure to a file and yield the file path.
The file is removed on exit from the context.
Parameters:
figure_or_ax: amatplotlib.figure.Figureor an object with a.figureattribute such as a set ofAxesdir: passed totempfile.TemporaryDirectoryext: optional file extension, default'png'
Release Log
Release 20241122:
- FigureSize: fix field factories.
- print_figure: wire a .png extension for the temp image.
Release 20230407: FigureSize: get defaults via $FIGURE_SIZE_DX, $FIGURE_SIZE_DY and $FIGURE_SIZE_DPI envvars.
Release 20220918:
- New FigureSize class.
- axes(): accept a FigureSize for figure.
Release 20220805: Initial PyPI release.
Release files for cs-mplutils 20241122
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| cs_mplutils-20241122.tar.gz | 4.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| cs_mplutils-20241122-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 10.2 kB
Release files / cs_mplutils-20241122.tar.gz
| Download URL | cs_mplutils-20241122.tar.gz |
|---|---|
| Size | 4.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5d140572a1c1283afdd5c8b8f85aa01e3e3c6866e4f279ebfd26b6a5aafd3af7
|
|
BLAKE2b-256 checksum How to use checksums |
c8f42cab3ef6ac14ce0f3fb189eb4d87ee2028262cac75b6684cd227f32eb92a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.10.6
|
Release files / cs_mplutils-20241122-py3-none-any.whl
| Download URL | cs_mplutils-20241122-py3-none-any.whl |
|---|---|
| Size | 5.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
04632a3d02de36a939f4f1a8ca2b11ce4d99d9ad134d0f380b614484258e5dcf
|
|
BLAKE2b-256 checksum How to use checksums |
1603860dadce69533f476b95ea61ffece047d072576407ed490b7cb78002abfb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.10.6
|