Plotting#

Module containing plotting functionalities.

PEDPY_BLUE = ()#
PEDPY_GREEN = ()#
PEDPY_GREY = ()#
PEDPY_ORANGE = ()#
PEDPY_PETROL = ()#
PEDPY_RED = ()#
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

  • 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

  • kwargs (Any) –

Returns:

matplotlib.axes.Axes instance where the density is plotted

Return type:

matplotlib.axes.Axes

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

  • 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

  • kwargs (Any) –

Returns:

matplotlib.axes.Axes instance where the density is plotted

Return type:

matplotlib.axes.Axes

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

  • 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

  • kwargs (Any) –

Returns:

matplotlib.axes.Axes instance where the flow is plotted

Return type:

matplotlib.axes.Axes

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

  • 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

  • kwargs (Any) –

Returns:

matplotlib.axes.Axes instance where the measurement setup is plotted

Return type:

matplotlib.axes.Axes

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

  • 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

  • kwargs (Any) –

Returns:

instances where the neighborhood is plotted

Return type:

matplotlib.axes.Axes

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

  • 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

  • kwargs (Any) –

Returns:

matplotlib.axes.Axes instance where the number of pedestrians is plotted

Return type:

matplotlib.axes.Axes

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

  • 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

  • kwargs (Any) –

Returns:

matplotlib.axes.Axes instance where the profiles are plotted

Return type:

matplotlib.axes.Axes

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

  • 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

  • kwargs (Any) –

Returns:

matplotlib.axes.Axes instance where the density is plotted

Return type:

matplotlib.axes.Axes

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

  • 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

  • kwargs (Any) –

Returns:

matplotlib.axes.Axes instance where the density is plotted

Return type:

matplotlib.axes.Axes

plot_time_distance(*, time_distance, frame_rate, axes=None, **kwargs)#

Plots the time to reach a target over distance.

Parameters:
  • time_distance (pd.DataFrame) – DataFrame containing information on time and distance to some target

  • frame_rate (float) – frame_rate of the trajectory

  • axes (matplotlib.axes.Axes) – Axes to plot on, if None new will be created

  • 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

  • kwargs (Any) –

Returns:

matplotlib.axes.Axes instance where the distance is plotted

Return type:

matplotlib.axes.Axes

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

  • 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

  • kwargs (Any) –

Returns:

matplotlib.axes.Axes instance where the trajectories are plotted

Return type:

matplotlib.axes.Axes

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

  • 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

  • traj_data (TrajectoryData, optional) – Will add pedestrian positions to the plot if provided.

  • 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

  • kwargs (Any) –

Returns:

matplotlib.axes.Axes instance where the Voronoi cells are plotted

Return type:

matplotlib.axes.Axes

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

  • line_color (optional) – color of the borders

  • line_color – line width of the borders

  • hole_color (optional) – background color of holes

  • hole_alpha (optional) – alpha of background color for holes

  • kwargs (Any) –

Returns:

matplotlib.axes.Axes instance where the walkable area is plotted

Return type:

matplotlib.axes.Axes