viz.py¶
Viz
¶
Provide a visualization base class.
Parameters:
-
(dpi¶int, default:100) –resolution for rasterized images
-
(font_size¶int, default:11) –general font size
Attributes:
-
dpi(int) –resolution for rasterized images
-
font_size(int) –general font size
-
fdict(dict[Any, Any]) –dictionary to which each figure is appended as it is generated
-
colors(Callable) –list of colors
-
n_colors(int) –number of colors
-
color_cycle(Callable) –color property cycle
-
markers(tuple) –list of markers
-
n_markers(int) –number of markers
-
marker_cycle(cycle) –cycle of markers
-
linestyle_list(tuple) –list of line styles (solid, dashdot, dashed, custom dashed)
-
color(Callable) –return i^th color
-
marker(Callable) –return i^th marker
Methods:
-
create_figure–Initialize a
MatPlotLibfigure. -
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 .venv/lib/python3.14/site-packages/langevin/base/viz.py
create_figure
¶
create_figure(
fig_name: str, fig_size: tuple[float, float] | None = None, dpi: int | None = None
) -> Figure
Initialize a MatPlotLib 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¶str) –name of figure; used as key in figures dictionary
-
(fig_size¶tuple[float, float] | None, default:None) –optional width and height of figure in inches
-
(dpi¶int | None, default:None) –rasterization resolution
Returns:
-
Figure–reference to figure
Source code in .venv/lib/python3.14/site-packages/langevin/base/viz.py
get_aspect
¶
Get aspect ratio of graph.
Parameters:
-
(axes¶Axes) –the
axesobject of the figure
Returns:
-
float–aspect ratio
Source code in .venv/lib/python3.14/site-packages/langevin/base/viz.py
get_fonts
¶
Fetch the names of all the font families available on the system.
Source code in .venv/lib/python3.14/site-packages/langevin/base/viz.py
naturalize
¶
Adjust graph aspect ratio into 'natural' ratio.
Source code in .venv/lib/python3.14/site-packages/langevin/base/viz.py
stretch
¶
stretch(
fig: Figure,
xs: tuple[float, float] | None = None,
ys: tuple[float, float] | None = None,
) -> None
Stretch graph axes by respective factors.