Plotter¶
-
class
stonesoup.plotter.
Plotter
[source]¶ Plotting class for building graphs of Stone Soup simulations
A plotting class which is used to simplify the process of plotting ground truths, measurements, clutter and tracks. Tracks can be plotted with uncertainty ellipses or particles if required. Legends are automatically generated with each plot.
-
fig
¶ Generated figure for graphs to be plotted on
-
ax
¶ Generated axes for graphs to be plotted on
- Type
-
handles_list
¶ A list of generated legend handles
- Type
-
labels_list
¶ A list of generated legend labels
- Type
list of str
-
plot_ground_truths
(truths, mapping, truths_label='Ground Truth', **kwargs)[source]¶ Plots ground truth(s)
Plots each ground truth path passed in to
truths
and generates a legend automatically. Ground truths are plotted as dashed lines with default colors.Users can change linestyle, color and marker using keyword arguments. Any changes will apply to all ground truths.
- Parameters
truths (set of
GroundTruthPath
) – Set of ground truths which will be plotted. If not a set, and instead a singleGroundTruthPath
type, the argument is modified to be a set to allow for iteration.mapping (list) – List of 2 items specifying the mapping of the x and y components of the state space.
**kwargs (dict) – Additional arguments to be passed to plot function. Default is
linestyle="--"
.
-
plot_measurements
(measurements, mapping, measurement_model=None, measurements_label='Measurements', **kwargs)[source]¶ Plots measurements
Plots detections and clutter, generating a legend automatically. Detections are plotted as blue circles by default unless the detection type is clutter. If the detection type is
Clutter
it is plotted as a yellow ‘tri-up’ marker.Users can change the color and marker of detections using keyword arguments but not for clutter detections.
- Parameters
measurements (list of
Detection
) – Detections which will be plotted. If measurements is a set of lists it is flattened.mapping (list) – List of 2 items specifying the mapping of the x and y components of the state space.
measurement_model (
Model
, optional) – User-defined measurement model to be used in finding measurement state inverses if they cannot be found from the measurements themselves.**kwargs (dict) – Additional arguments to be passed to plot function for detections. Defaults are
marker='o'
andcolor='b'
.
-
plot_tracks
(tracks, mapping, uncertainty=False, particle=False, track_label='Track', **kwargs)[source]¶ Plots track(s)
Plots each track generated, generating a legend automatically. If
uncertainty=True
, uncertainty ellipses are plotted. Ifparticle=True
, particles are plotted. Tracks are plotted as solid lines with point markers and default colors. Uncertainty ellipses are plotted with a default color which is the same for all tracks.Users can change linestyle, color and marker using keyword arguments. Uncertainty ellipses will also be plotted with the user defined colour and any changes will apply to all tracks.
- Parameters
tracks (set of
Track
) – Set of tracks which will be plotted. If not a set, and instead a singleTrack
type, the argument is modified to be a set to allow for iteration.mapping (list) – List of 2 items specifying the mapping of the x and y components of the state space.
uncertainty (bool) – If True, function plots uncertainty ellipses.
particle (bool) – If True, function plots particles.
track_label (str) – Label to apply to all tracks for legend.
**kwargs (dict) – Additional arguments to be passed to plot function. Defaults are
linestyle="-"
,marker='.'
andcolor=None
.
-
static
ellipse_legend
(ax, label_list, color_list, **kwargs)[source]¶ Adds an ellipse patch to the legend on the axes. One patch added for each item in label_list with the corresponding color from color_list.
- Parameters
ax (matplotlib.axes.Axes) – Looks at the plot axes defined
label_list (list of str) – Takes in list of strings intended to label ellipses in legend
color_list (list of str) – Takes in list of colors corresponding to string/label Must be the same length as label_list
**kwargs (dict) – Additional arguments to be passed to plot function. Default is
alpha=0.2
.
-