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

Type

matplotlib.figure.Figure

ax

Generated axes for graphs to be plotted on

Type

matplotlib.axes.Axes

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, **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 single GroundTruthPath 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, **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' and color='b'.

plot_tracks(tracks, mapping, uncertainty=False, particle=False, **kwargs)[source]

Plots track(s)

Plots each track generated, generating a legend automatically. If uncertainty=True, uncertainty ellipses are plotted. If particle=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 single Track 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.

• **kwargs (dict) – Additional arguments to be passed to plot function. Defaults are linestyle="-", marker='.' and color=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.