plotter module
Define the generic Plotter.
- class Plotter(*args, **kwargs)[source]
Bases:
objectAn object used to plot data.
- abstract plot(data, x, y, grid=True, axes=None, xlabel=None, ylabel=None, label=None, **kwargs)[source]
Plot 2D data.
- Parameters:
data (pandas.DataFrame) – Holds all data to plot.
x (str) – Name of column in
datafor x/y.y (str) – Name of column in
datafor x/y.grid (bool, optional) – If grid should be plotted. Default is True.
axes (Any | None, optional) – Axes to re-use, if provided. The default is None (plot on new axis).
xlabel (str | None, optional) – Name of the labels. If not provided, we use the markdown equivalent of x/y, if defined in
markdown.ylabel (str | None, optional) – Name of the labels. If not provided, we use the markdown equivalent of x/y, if defined in
markdown.label (str | None, optional) – If provided, overrides the legend. Useful when several simulations are shown on the same plot.
kwargs – Other keyword passed to the actual plot method.
- Return type:
- Returns:
Any – Axis object.
Any – Color used for the plot.
- abstract hist(data, x, bins=200, hist_range=None, **kwargs)[source]
Plot a histogram.
- Parameters:
data (pandas.DataFrame) – Holds all data to plot.
x (PARTICLE_0D_t) – Name of the column in
datato plot.bins (int, optional) – Number of bins in the histogram. The default is 200.
hist_range (tuple[float, float] | None, optional) – Lower and upper range for the calculation of the histogram. The default is None.
kwargs – Other keyword arguments passed to the actual plot method.
- Returns:
Axis object.
- Return type:
Any
- abstract plot_3d(data, key, *args, **kwargs)[source]
Create a 3D plot.
- Parameters:
data (Any) – Object storing the data to plot.
key (PARTICLE_3D_t) – Name/nature of the data to plot.
- Return type:
- abstract plot_trajectory(points, emission_color=None, collision_color=None, collision_point=array([], dtype=float64), lw=7, r=8, **kwargs)[source]
Plot the
Particletrajectory stored inpoints.- Parameters:
points (
list[ndarray[tuple[Any,...],dtype[float64]]]) – List of positions, as returned byVector.to_list().emission_color (
str|None, default:None) – If provided, the first known position is colored with this color.collision_color (
str|None, default:None) – If provided, the last known position is colored with this color.collision_point (
ndarray[tuple[Any,...],dtype[float64]], default:array([], dtype=float64)) – If provided andcollision_coloris notNone, we plot this point instead of the last ofpoints. This is useful when the extrapolated time is large, and actuel collision point may differ significantly from last position points.lw (
int, default:7) – Trajectory line width.r (
int, default:8) – Size of the emission/collision points.
- Return type: