agepy.ageplot.figsize
- class figsize(medium=None)
Bases:
objectClass for choosing the appropriate size of matplotlib figures.
This class provides access to the width and height of the available space in different media in order to choose a figure size for matplotlib plots.
- Parameters:
- medium: str, optional
Name of the medium. Media, for which the size is implemented, can be viewed with
figsize.media. Default: None
- Attributes:
- w: float
Recommended width for a figure. Most of the time this will be equivalent to the full available width.
- h: float
Recommended height corresponding to the width (width * 3 / 4).
- wh: tuple
Tuple (w, h) containing the width and recommended height. If there is a corresponding style sheet, the default figure size will be set to (w, h) by
agepy.ageplot.use().- hmax: float
Height in inches available for a figure.
- media: list
Class wide attribute containing a list of media, for which the figsize is implemented.
Examples
A simple example for the PCCP journal:
>>> from agepy import ageplot >>> my_figsize = ageplot.figsize("pccp") >>> my_figsize.wh (3.54, 2.6550000000000002)
This could be used for a matplotlib plot like this:
>>> import matplotlib.pyplot as plt >>> fig, ax = plt.subplots(1, figsize=(my_figsize.w, my_figsize.hmax / 3)) >>> plt.plot([1, 2, 3], [4, 5, 6])
Methods