Skip to content

Commit b095751

Browse files
Kilidschschroedtert
authored andcommitted
fix: time_distance plot initial point
Did not plot the initial position of all pedestrians as a scatter plot, if not all pedestrian's trajectories started at the same frame
1 parent 316bd1f commit b095751

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

pedpy/plotting/plotting.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -804,10 +804,10 @@ def _scatter_min_data(
804804
805805
Args:
806806
axes: The matplotlib axes to plot on.
807-
ped_data: DataFrame containing a single pedestrian's data.
807+
ped_data: DataFrame containing pedestrian data.
808808
color: Color of the scatter plot marker.
809809
"""
810-
min_data = ped_data[ped_data.frame == ped_data.frame.min()]
810+
min_data = ped_data.loc[ped_data.groupby(ID_COL)[FRAME_COL].idxmin()]
811811
axes.scatter(
812812
min_data.distance,
813813
min_data.time,
@@ -825,13 +825,13 @@ def _scatter_min_data_with_color(
825825
826826
Args:
827827
axes: The matplotlib axes to plot on.
828-
ped_data: DataFrame containing a single pedestrian's data.
828+
ped_data: DataFrame containing pedestrian data.
829829
norm: Normalization for the colormap based on speed.
830830
cmap: The colormap to use for coloring the line based on speed.
831831
frame_rate: Frame rate used to adjust time values.
832832
color: Color of the scatter plot marker.
833833
"""
834-
min_data = ped_data[ped_data.frame == ped_data.frame.min()]
834+
min_data = ped_data.loc[ped_data.groupby(ID_COL)[FRAME_COL].idxmin()]
835835
axes.scatter(
836836
min_data.distance,
837837
min_data.time,

0 commit comments

Comments
 (0)