Skip to content

Commit ddcd63e

Browse files
authored
Fix distance to time plot (#366)
During the plotting the time was divided by the frame rate, which is not needed here. This resulted in wrong times displayed in the plot. Removed the wrong division.
1 parent 9c83acd commit ddcd63e

1 file changed

Lines changed: 4 additions & 7 deletions

File tree

pedpy/plotting/plotting.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -504,7 +504,6 @@ def plot_time_distance(
504504
*,
505505
time_distance: pd.DataFrame,
506506
speed: Optional[pd.DataFrame] = None,
507-
frame_rate: float,
508507
axes: Optional[matplotlib.axes.Axes] = None,
509508
**kwargs: Any,
510509
) -> matplotlib.axes.Axes:
@@ -517,7 +516,6 @@ def plot_time_distance(
517516
time_distance (pd.DataFrame): DataFrame containing information on time and
518517
distance to some target
519518
speed (pd.DataFrame): DataFrame containing speed calculation.
520-
frame_rate(float): frame_rate of the trajectory
521519
axes (matplotlib.axes.Axes): Axes to plot on, if None new will be created
522520
marker_color (optional): color of the markers on the plot
523521
line_color (optional): color of the lines on the plot
@@ -560,7 +558,7 @@ def _scatter_min_data(
560558
min_data = ped_data[ped_data.frame == ped_data.frame.min()]
561559
axes.scatter(
562560
min_data.distance,
563-
min_data.time_seconds,
561+
min_data.time,
564562
color=color,
565563
s=5,
566564
marker="o",
@@ -584,7 +582,7 @@ def _scatter_min_data_with_color(
584582
min_data = ped_data[ped_data.frame == ped_data.frame.min()]
585583
axes.scatter(
586584
min_data.distance,
587-
min_data.time_seconds,
585+
min_data.time,
588586
c=min_data.speed,
589587
cmap="jet",
590588
norm=norm,
@@ -606,7 +604,7 @@ def _plot_line(
606604
"""
607605
axes.plot(
608606
ped_data.distance,
609-
ped_data.time_seconds,
607+
ped_data.time,
610608
color=color,
611609
alpha=0.7,
612610
lw=0.25,
@@ -625,7 +623,7 @@ def _plot_colored_line(
625623
norm: Normalization for the colormap based on speed.
626624
cmap: The colormap to use for coloring the line based on speed.
627625
"""
628-
points = ped_data[["distance", "time_seconds"]].to_numpy()
626+
points = ped_data[["distance", "time"]].to_numpy()
629627
speed_id = ped_data.speed.to_numpy()
630628
segments = [
631629
[
@@ -712,7 +710,6 @@ def _plot_without_colors(
712710

713711
axes = axes or plt.gca()
714712
_setup_plot(axes, **kwargs)
715-
time_distance["time_seconds"] = time_distance.time / frame_rate
716713
if speed is not None:
717714
_plot_with_speed_colors(axes, time_distance, speed)
718715
else:

0 commit comments

Comments
 (0)