I'm trying to plot a certain subset of my latitude/longitude data using ipyleaflet and based on an index value I get from a time value I choose. I want to plot this first subset and then I want to change the time value and have the next subset of plotted points start at the end of the last subset. Just in case, I'm using the Jupyter extension inside VSC but I don't think that's really relevant to the question.
So far I have:
value1 = 1695149939316.0
idx = df_cleaned[df_cleaned['aoe'] == value1].index.values
idx = idx[0]
lat_values = df_cleaned.loc[0:idx, 'lat']
lon_values = df_cleaned.loc[0:idx, 'lon']
for lat_values, lon_values in zip(lat_values, lon_values):
mark = CircleMarker(location = [lat_values, lon_values])
mark.radius = 1
m += mark
So in this example, I manually input value1 as some time. This code can take that time and plot all the lat/lon points before it.
But, I would like to be able to manually change the value of value1 and have the code automatically place all the lat/lon points between the last value plotted and the new value from the index. Right now changing the time value will just replot all the points that were already plotted plus the new points I want.
For the sake of example, if I have:
lat = [1, 2, 3, 4, 5]
lon = [6, 7, 8, 9, 10]
aoe = [11, 12, 13, 14, 15]
I would like to be able to input time (aoe) as 12 initially, have the function plot [1,6] and [2,7] ([lat,lon]), then come back, input time as 14 and have the function plot just [3,8] and [4,9].
I've tried to play around with a counter that would return the desired index location after each set of points is plotted and take the place of the 0 value inside the .loc function but I'm not sure how to format a loop that will do that.
Is there some way to have a loop run back through all these lines once the initial value is changed to return only the points inside a desired subset and not all the previous points?