Skip to content

Commit

Permalink
Add sync_plots option
Browse files Browse the repository at this point in the history
  • Loading branch information
giswqs committed Nov 27, 2024
1 parent 21c199c commit 5b128ab
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion leafmap/maplibregl.py
Original file line number Diff line number Diff line change
Expand Up @@ -3969,6 +3969,7 @@ def edit_gps_trace(
circle_size: int = 48,
webGL: bool = False,
download: bool = False,
sync_plots: bool = False,
**kwargs,
) -> Any:
"""
Expand All @@ -3990,6 +3991,7 @@ def edit_gps_trace(
circle_size (int, optional): The size of the GPS trace points. Defaults to 48.
webGL (bool, optional): Whether to use WebGL (bqplot-gl) for rendering. Defaults to False.
download (bool, optional): Whether to generate links for downloading the edited GPS traces. Defaults to False.
sync_plots (bool, optional): Whether to synchronize the zoom and pan of the plots. Defaults to False.
**kwargs: Additional keyword arguments.
Returns:
Expand Down Expand Up @@ -4019,6 +4021,8 @@ def edit_gps_trace(
x_sc = LinearScale()
y_sc = LinearScale()

setattr(m, "_x_sc", x_sc)

features = sorted(list(m.gps_trace.columns)[1:-3])
if "max_signal_strength" in features:
default_feature = "max_signal_strength"
Expand Down Expand Up @@ -4274,7 +4278,10 @@ def features_change(change):

x = m.gps_trace.index
y = m.gps_trace[selected_feature]
# x_sc = LinearScale()
if sync_plots:
x_sc = m._x_sc
else:
x_sc = LinearScale()
y_sc2 = LinearScale()

# Create scatter plots for each annotation category with the appropriate colors and labels
Expand Down

0 comments on commit 5b128ab

Please sign in to comment.