Plotting#
Module containing plotting functionalities.
- PEDPY_BLUE = ()#
- PEDPY_GREEN = ()#
- PEDPY_GREY = ()#
- PEDPY_ORANGE = ()#
- PEDPY_PETROL = ()#
- PEDPY_RED = ()#
- plot_acceleration(*, acceleration, axes=None, **kwargs)#
Plot the acceleration over time.
- Parameters:
acceleration (pd.Series) – acceleration per frame
axes (matplotlib.axes.Axes) – Axes to plot on, if None new will be created
kwargs (Any) – Additional parameters to change the plot appearance, see below for list of usable keywords
- Keyword Arguments:
color (optional) – color of the plot
title (optional) – title of the plot
x_label (optional) – label on the x-axis
y_label (optional) – label on the y-axis
- Returns:
matplotlib.axes.Axes instance where the density is plotted
- Return type:
- plot_density(*, density, axes=None, **kwargs)#
Plot the density over time.
- Parameters:
density (pd.DataFrame) – density per frame
axes (matplotlib.axes.Axes) – Axes to plot on, if None new will be created
kwargs (Any) – Additional parameters to change the plot appearance, see below for list of usable keywords
- Keyword Arguments:
color (optional) – color of the plot
title (optional) – title of the plot
x_label (optional) – label on the x-axis
y_label (optional) – label on the y-axis
- Returns:
matplotlib.axes.Axes instance where the density is plotted
- Return type:
- plot_density_at_line(*, density_at_line, axes=None, **kwargs)#
Plot the density of both species and the total density at the line.
- Parameters:
density_at_line (pd.DataFrame) – DataFrame containing information on density at the line
axes (matplotlib.axes.Axes, optional) – Axes to plot on, if None new will be created
kwargs (Any) – Additional parameters to change the plot appearance, see below for list of usable keywords
- Keyword Arguments:
title (optional) – title of the plot
color_species1 (optional) – color of the density of species 1 in the plot
color_species2 (optional) – color of the density of species 2 in the plot
color_total (optional) – color of the total density in the plot
label_species1 (optional) – tag of species 1 in the legend
label_species2 (optional) – tag of species 2 in the legend
label_total (optional) – tag of total speed in the legend
- Returns:
matplotlib.axes.Axes instance where the densities are plotted
- Return type:
- plot_density_distribution(*, density, axes=None, **kwargs)#
Plot the density distribution as violin plot.
- Parameters:
density (pd.DataFrame) – individual density of the pedestrian
axes (matplotlib.axes.Axes) – Axes to plot on, if None new will be created
kwargs (Any) – Additional parameters to change the plot appearance, see below for list of usable keywords
- Keyword Arguments:
facecolor (optional) – color of the plot body
edgecolor (optional) – color of the edges of the plot
title (optional) – title of the plot
x_label (optional) – label on the x-axis
y_label (optional) – label on the y-axis
- Returns:
matplotlib.axes.Axes instance where the density is plotted
- Return type:
- plot_flow(*, flow, axes=None, **kwargs)#
Plot the flow.
- Parameters:
flow (pd.DataFrame) – flow for some given crossing_frames and nt
axes (matplotlib.axes.Axes) – Axes to plot on, if None new will be created
kwargs (Any) – Additional parameters to change the plot appearance, see below for list of usable keywords
- Keyword Arguments:
color (optional) – color of the plot
title (optional) – title of the plot
x_label (optional) – label on the x-axis
y_label (optional) – label on the y-axis
- Returns:
matplotlib.axes.Axes instance where the flow is plotted
- Return type:
- plot_flow_at_line(*, flow_at_line, axes=None, **kwargs)#
Plot the flow of both species and the total flow at the line.
- Parameters:
flow_at_line (pd.DataFrame) – DataFrame containing information on flow at the line
axes (matplotlib.axes.Axes, optional) – Axes to plot on, if None new will be created
kwargs (Any) – Additional parameters to change the plot appearance, see below for list of usable keywords
- Keyword Arguments:
title (optional) – title of the plot
color_species1 (optional) – color of the flow of species 1 in the plot
color_species2 (optional) – color of the flow of species 2 in the plot
color_total (optional) – color of the total flow in the plot
label_species1 (optional) – tag of species 1 in the legend
label_species2 (optional) – tag of species 2 in the legend
label_total (optional) – tag of total speed in the legend
- Returns:
matplotlib.axes.Axes instance where the profiles are plotted
- Return type:
- plot_measurement_setup(*, traj=None, walkable_area=None, measurement_areas=None, measurement_lines=None, axes=None, **kwargs)#
Plot the given measurement setup in 2D.
- Parameters:
traj (TrajectoryData, optional) – Trajectory object to plot
walkable_area (WalkableArea, optional) – WalkableArea object to plot
measurement_areas (List[MeasurementArea], optional) – List of measurement areas to plot
measurement_lines (List[MeasurementLine], optional) – List of measurement lines to plot
axes (matplotlib.axes.Axes, optional) – Axes to plot on, if None new will be created
kwargs (Any) – Additional parameters to change the plot appearance, see below for list of usable keywords
- Keyword Arguments:
ma_line_color (optional) – color of the measurement areas borders
ma_line_width (optional) – line width of the measurement areas borders
ma_color (optional) – fill color of the measurement areas
ma_alpha (optional) – alpha of measurement area fill color
ml_color (optional) – color of the measurement lines
ml_width (optional) – line width of the measurement lines
traj_color (optional) – color of the trajectories
traj_width (optional) – width of the trajectories
traj_alpha (optional) – alpha of the trajectories
traj_start_marker (optional) – marker to indicate the start of the trajectory
traj_end_marker (optional) – marker to indicate the end of the trajectory
line_color (optional) – color of the borders
line_width (optional) – line width of the borders
hole_color (optional) – background color of holes
hole_alpha (optional) – alpha of background color for holes
- Returns:
matplotlib.axes.Axes instance where the measurement setup is plotted
- Return type:
- plot_neighborhood(*, pedestrian_id, neighbors, frame, voronoi_data, walkable_area, axes=None, **kwargs)#
Plot the neighborhood.
- Parameters:
pedestrian_id (int) – id of pedestrian to plot neighbors for
neighbors (pd.DataFrame) – neighborhood data based on the Voronoi cells
frame (int) – frame for which the plot is created
voronoi_data (pd.DataFrame) – individual Voronoi polygon for each person and frame
walkable_area (WalkableArea) – WalkableArea object of plot
axes (matplotlib.axes.Axes) – Axes to plot on, if None new will be created
kwargs (Any) – Additional parameters to change the plot appearance, see below for list of usable keywords
- Keyword Arguments:
hole_color (optional) – color of the holes in the walkable area
base_color (optional) – color of the base pedestrians
neighbor_color (optional) – color of neighbor pedestrians
default_color (optional) – color of default pedestrians
- Returns:
instances where the neighborhood is plotted
- Return type:
- plot_nt(*, nt, axes=None, **kwargs)#
Plot the number of pedestrians over time.
- Parameters:
nt (pd.DataFrame) – cumulative number of pedestrians over time
axes (matplotlib.axes.Axes) – Axes to plot on, if None new will be created
kwargs (Any) – Additional parameters to change the plot appearance, see below for list of usable keywords
- Keyword Arguments:
color (optional) – color of the plot
title (optional) – title of the plot
x_label (optional) – label on the x-axis
y_label (optional) – label on the y-axis
- Returns:
matplotlib.axes.Axes instance where the number of pedestrians is plotted
- Return type:
- plot_profiles(*, walkable_area, profiles, axes=None, **kwargs)#
Plot the mean of the profiles.
- Parameters:
walkable_area (WalkableArea) – walkable area of the plot
profiles (list) – List of profiles like speed or density profiles
axes (matplotlib.axes.Axes) – Axes to plot on, if None new will be created
kwargs (Any) – Additional parameters to change the plot appearance, see below for list of usable keywords
- Keyword Arguments:
title (optional) – title of the plot
walkable_color (optional) – color of the walkable area in the plot
hole_color (optional) – background color of holes
hole_alpha (optional) – alpha of background color for holes
- Returns:
matplotlib.axes.Axes instance where the profiles are plotted
- Return type:
- plot_speed(*, speed, axes=None, **kwargs)#
Plot the speed over time.
- Parameters:
speed (pd.Series) – speed per frame
axes (matplotlib.axes.Axes) – Axes to plot on, if None new will be created
kwargs (Any) – Additional parameters to change the plot appearance, see below for list of usable keywords
- Keyword Arguments:
color (optional) – color of the plot
title (optional) – title of the plot
x_label (optional) – label on the x-axis
y_label (optional) – label on the y-axis
- Returns:
matplotlib.axes.Axes instance where the density is plotted
- Return type:
- plot_speed_at_line(*, speed_at_line, axes=None, **kwargs)#
Plot the speed of both species and the total speed at the line.
- Parameters:
speed_at_line (pd.DataFrame) – DataFrame containing information on speed at the line
axes (matplotlib.axes.Axes, optional) – Axes to plot on, if None new will be created
kwargs (Any) – Additional parameters to change the plot appearance, see below for list of usable keywords
- Keyword Arguments:
title (optional) – title of the plot
color_species1 (optional) – color of the speed of species 1 in the plot
color_species2 (optional) – color of the speed of species 2 in the plot
color_total (optional) – color of the total speed in the plot
label_species1 (optional) – tag of species 1 in the legend
label_species2 (optional) – tag of species 2 in the legend
label_total (optional) – tag of total speed in the legend
- Returns:
matplotlib.axes.Axes instance where the speeds are plotted
- Return type:
- plot_speed_distribution(*, speed, axes=None, **kwargs)#
Plot the speed distribution as violin plot.
- Parameters:
speed (pd.DataFrame) – speed of the pedestrians
axes (matplotlib.axes.Axes) – Axes to plot on, if None new will be created
kwargs (Any) – Additional parameters to change the plot appearance, see below for list of usable keywords
- Keyword Arguments:
facecolor (optional) – color of the plot body
edgecolor (optional) – color of the edges of the plot
title (optional) – title of the plot
x_label (optional) – label on the x-axis
y_label (optional) – label on the y-axis
- Returns:
matplotlib.axes.Axes instance where the density is plotted
- Return type:
- plot_time_distance(*, time_distance, speed=None, axes=None, **kwargs)#
Plots the time to reach a target over distance.
If a speed DataFrame is provided, lines will be colored according to speed values.
- Parameters:
time_distance (pd.DataFrame) – DataFrame containing information on time and distance to some target
speed (pd.DataFrame) – DataFrame containing speed calculation.
axes (matplotlib.axes.Axes) – Axes to plot on, if None new will be created
kwargs (Any) – Additional parameters to change the plot appearance, see below for list of usable keywords
- Keyword Arguments:
marker_color (optional) – color of the markers on the plot
line_color (optional) – color of the lines on the plot
title (optional) – title of the plot
x_label (optional) – label on the x-axis
y_label (optional) – label on the y-axis
- Returns:
matplotlib.axes.Axes instance where the distance is plotted
- Return type:
- plot_trajectories(*, traj, walkable_area=None, axes=None, **kwargs)#
Plot the given trajectory and walkable area in 2-D.
- Parameters:
traj (TrajectoryData) – Trajectory object to plot
walkable_area (WalkableArea, optional) – WalkableArea object to plot
axes (matplotlib.axes.Axes, optional) – Axes to plot on, if None new will be created
kwargs (Any) – Additional parameters to change the plot appearance, see below for list of usable keywords
- Keyword Arguments:
traj_color (optional) – color of the trajectories
traj_width (optional) – width of the trajectories
traj_alpha (optional) – alpha of the trajectories
traj_start_marker (optional) – marker to indicate the start of the trajectory
traj_end_marker (optional) – marker to indicate the end of the trajectory
line_color (optional) – color of the borders
line_width (optional) – line width of the borders
hole_color (optional) – background color of holes
hole_alpha (optional) – alpha of background color for holes
- Returns:
matplotlib.axes.Axes instance where the trajectories are plotted
- Return type:
- plot_voronoi_cells(*, voronoi_data, frame, traj_data=None, walkable_area=None, measurement_area=None, axes=None, **kwargs)#
Plot the Voronoi cells, walkable able, and measurement area in 2D.
- Parameters:
voronoi_data (pd.DataFrame) – voronoi polygon data as returned by
compute_voronoi_density()
frame (int) – frame index
traj_data (TrajectoryData, optional) – Will add pedestrian positions to the plot if provided.
walkable_area (WalkableArea, optional) – WalkableArea object to plot
measurement_area (MeasurementArea, optional) – measurement area used to compute the Voronoi cells
axes (matplotlib.axes.Axes, optional) – Axes to plot on, if None new will be created
kwargs (Any) – Additional parameters to change the plot appearance, see below for list of usable keywords
- Keyword Arguments:
ped_color (optional) – color used to display current ped positions
voronoi_border_color (optional) – border color of Voronoi cells
voronoi_inside_ma_alpha (optional) – alpha of part of Voronoi cell inside the measurement area, data needs to contain column “intersection”!
voronoi_outside_ma_alpha (optional) – alpha of part of Voronoi cell outside the measurement area
color_by_column (str, optional) – Optioanlly provide a column name to specify the data to color the cell. Only supports Integer and Float data types. E.g. color_by_column DENSITY_COL
vmin (optional) – vmin of colormap, only used when color_mode != “id”
vmax (optional) – vmax of colormap, only used when color_mode != “id”
show_colorbar (optional) – colorbar is displayed, only used when color_mode != “id”
cb_location (optional) – location of the colorbar, only used when color_mode != “id”
ma_line_color (optional) – color of the measurement areas borders
ma_line_width (optional) – line width of the measurement areas borders
ma_color (optional) – fill color of the measurement areas
ma_alpha (optional) – alpha of measurement area fill color
ml_color (optional) – color of the measurement lines
ml_width (optional) – line width of the measurement lines
line_color (optional) – color of the borders
line_width (optional) – line width of the borders
hole_color (optional) – background color of holes
hole_alpha (optional) – alpha of background color for holes
cmap (optional) – colormap used for
- Returns:
matplotlib.axes.Axes instance where the Voronoi cells are plotted
- Return type:
- plot_walkable_area(*, walkable_area, axes=None, **kwargs)#
Plot the given walkable area in 2-D.
- Parameters:
walkable_area (WalkableArea) – WalkableArea object to plot
axes (matplotlib.axes.Axes) – Axes to plot on, if None new will be created
kwargs (Any) – Additional parameters to change the plot appearance, see below for list of usable keywords
- Keyword Arguments:
line_color (optional) – color of the borders
line_width (optional) – line width of the borders
hole_color (optional) – background color of holes
hole_alpha (optional) – alpha of background color for holes
- Returns:
matplotlib.axes.Axes instance where the walkable area is plotted
- Return type: