reproducible-notebooks / ERDDAP_timeseries_explorer

Simple interactive ERDDAP time series explorer using Jupyter Widgets
MIT License
6 stars 4 forks source link

Use bqplot to make an ERDDAP time series plot #2

Closed rsignell-usgs closed 6 years ago

rsignell-usgs commented 7 years ago

We know how to make ERDDAP time series plots in pandas, but how does it work in bqplot?

rsignell-usgs commented 6 years ago

more lines of code, but given a series in dataframe df, this works fine:

dt_x = bq.DateScale()
sc_y = bq.LinearScale()

initial_dataset = datasets[0]
kwargs = {'time%3E=': min_time, 'time%3C=': max_time}
df, var = get_data(initial_dataset, initial_standard_name, kwargs)
time_series = bq.Lines(x=df.index, y=df[var], scales={'x': dt_x, 'y': sc_y})
ax_x = bq.Axis(scale=dt_x, label='Time')
ax_y = bq.Axis(scale=sc_y, orientation='vertical')
figure = bq.Figure(marks=[time_series], axes=[ax_x, ax_y])
figure.title = '{} - {}'.format(initial_dataset[:nchar], var)
figure.layout.height = '300px'
figure.layout.width = '800px'