viz.py
Viz
Provide a visualization base class.
Parameters:
-
(dpiint, default:100) –resolution for rasterized images
-
(font_sizeint, 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/lvn/base/viz.py
70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 | |
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_namestr) –name of figure; used as key in figures dictionary
-
(fig_sizetuple[float, float] | None, default:None) –optional width and height of figure in inches
-
(dpiint | None, default:None) –rasterization resolution
Returns:
-
Figure–reference to figure
Source code in .venv/lib/python3.14/site-packages/lvn/base/viz.py
107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 | |
get_aspect
Get aspect ratio of graph.
Parameters:
-
(axesAxes) –the
axesobject of the figure
Returns:
-
float–aspect ratio
Source code in .venv/lib/python3.14/site-packages/lvn/base/viz.py
146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 | |
get_fonts
Fetch the names of all the font families available on the system.
Source code in .venv/lib/python3.14/site-packages/lvn/base/viz.py
94 95 96 97 98 99 100 101 102 103 104 105 | |
naturalize
naturalize(fig: Figure) -> None
Adjust graph aspect ratio into 'natural' ratio.
Source code in .venv/lib/python3.14/site-packages/lvn/base/viz.py
173 174 175 176 177 178 | |
stretch
stretch(
fig: Figure,
xs: tuple[float, float] | None = None,
ys: tuple[float, float] | None = None,
) -> None
Stretch graph axes by respective factors.
Source code in .venv/lib/python3.14/site-packages/lvn/base/viz.py
180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 | |