experimental.plotter.matplotlib_helper module
Create helper functions specific to matplotlib-based plotters.
- _plot_aperture(aperture: Aperture, x_0: float, width: float) Rectangle
Add a thin line to show an aperture.
- _plot_drift(drift: Drift, x_0: float, width: float) Rectangle
Add a little rectangle to show a drift.
- _plot_field_map(field_map: FieldMap, x_0: float, width: float) Ellipse
Add an ellipse to show a field_map.
- _plot_quad(quad: Quad, x_0: float, width: float) Polygon
Add a crossed large rectangle to show a quad.
- clean_axes(axlist: Sequence[Axes]) None
Clean given axis.
- clean_figure(fignumlist: Sequence[int]) None
Clean axis of Figs in fignumlist.
- create_fig_if_not_exists(axnum: int | Sequence[int], title: str = '', sharex: bool = False, num: int = 1, clean_fig: bool = False, **kwargs: bool | str | int) list[Axes]
Check if figures were already created, create it if not.
- Parameters:
axnum (int | Sequence[int]) – Axes indexes as understood by fig.add_subplot or number of desired axes.
title (str, optional) – Title of the figure. The default is an empty string. It will not override a pre-existing title.
sharex (boolean, optional) – If x axis should be shared. The default is False.
num (int, optional) – Fig number. The default is 1.
clean_fig (bool, optional) – If the previous plot should be erased from Figure. The default is False.
- plot_section(axes: Axes, elts: ListOfElements, x_axis: str = 'z_abs') None
Add light grey rectangles behind the plot to show the sections.
- plot_structure(axes: Axes, elts: ListOfElements, x_axis: str = 'z_abs') None
Plot structure of the linac under study.