base.py¶
GraphingBase
¶
Provide a visualization base class.
Parameters¶
dpi: resolution for rasterized images font_size: general font size
Attributes¶
dpi (int):
resolution for rasterized images
font_size (int):
general font size
fdict (dict):
dictionary to which each figure is appended as it is generated
colors (list):
list of colors
n_colors (int):
number of colors
color_cycle (:obj:itertools cycle <itertools.cycle>):
color property cycle
markers (list):
list of markers
n_markers (:obj:itertools cycle <itertools.cycle>):
number of markers
marker_cycle (int):
cycle of markers
linestyle_list (list):
list of line styles (solid, dashdot, dashed, custom dashed)
color (:obj:lambda(i) <lambda>):
return i^th color
marker (:obj:lambda(i) <lambda>):
return i^th marker
Methods:
-
create_figure–Initialize a :mod:
Pyplot <matplotlib.pyplot>figure. -
get_aspect–Get aspect ratio of graph.
-
get_fonts–Fetch the names of all the font families available on the system.
-
naturalize–Adjust graph aspect ratio into 'natural' ratio.
-
stretch–Stretch graph axes by respective factors.
Source code in erosionfront/visualization/base.py
create_figure
¶
create_figure(
fig_name: str, fig_size: tuple[float, float] | None = None, dpi: int | None = None
) -> Figure
Initialize a :mod:Pyplot <matplotlib.pyplot> figure.
Set its size and dpi, set the font size, choose the Arial font family if possible, and append it to the figures dictionary.
Parameters¶
fig_name: name of figure; used as key in figures dictionary fig_size: optional width and height of figure in inches dpi: rasterization resolution
Returns¶
:obj:Pyplot figure <matplotlib.figure.Figure>:
reference to :mod:MatPlotLib/Pyplot <matplotlib.pyplot>
figure
Source code in erosionfront/visualization/base.py
get_aspect
¶
get_aspect(axes: Axes) -> float
Get aspect ratio of graph.
Parameters¶
axes:
the axes object of the figure
Returns¶
float: aspect ratio
Source code in erosionfront/visualization/base.py
get_fonts
¶
Fetch the names of all the font families available on the system.
Source code in erosionfront/visualization/base.py
naturalize
¶
Adjust graph aspect ratio into 'natural' ratio.
Source code in erosionfront/visualization/base.py
stretch
¶
stretch(
fig: Figure,
xs: tuple[float, float] | None = None,
ys: tuple[float, float] | None = None,
) -> None
Stretch graph axes by respective factors.