xarray-tutorial icon indicating copy to clipboard operation
xarray-tutorial copied to clipboard

Use dynamic=False and groupby multi-dim

Open ahuang11 opened this issue 1 year ago β€’ 7 comments

I think it's more impressive if users can try out the slider.

image

ahuang11 avatar Jun 11 '24 22:06 ahuang11

Check out this pull request onΒ  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

Thanks @ahuang11 I agree this would be nice, but if I view the HTML generated by jupyterbook the slider doesn't update the plot. You can access the HTML as a build artifact in the CI https://github.com/xarray-contrib/xarray-tutorial/actions/runs/9473640096?pr=268

maybe related: https://github.com/holoviz/hvplot/issues/1241

The preview of the slider that should advance is here https://xarray-contrib-xarray-tutorial-preview-pr-268.surge.sh/overview/xarray-in-45-min.html#holoviz

scottyhq avatar Jun 20 '24 17:06 scottyhq

🎊 PR Preview 38e88b58f4599f68ad322b4a2dfda5083d2703c1 has been successfully built and deployed to https://xarray-contrib-xarray-tutorial-preview-pr-268.surge.sh

πŸ• Build time: 0.01s

πŸ€– By surge-preview

github-actions[bot] avatar Jun 25 '24 02:06 github-actions[bot]

You're right; seems like an issue.

To get around that, maybe can demo how powerful hvPlot can be simply by ticking off keywords such as groupby, hover, responsive, etc? Unless that's too many keywords?

image

Not sure which one I like more, explicit x/y and implicit groupby, or vice versa.

import hvplot.xarray

ds.groupby("time.season").mean().hvplot(
    groupby=["season", "lat"],
    hover="vline",
    responsive=True,
    dynamic=False,
    ylim=(240, 310),
    min_height=350,
)
ds.groupby("time.season").mean().hvplot(
    x="lon",
    y="air",
    hover="vline",
    responsive=True,
    dynamic=False,
    ylim=(240, 310),
    min_height=350,
)

ahuang11 avatar Jul 01 '24 23:07 ahuang11

Those are great suggestions! Whatever your think is best without being too much to take in.

For the existing case, it seems that just removing widget_location='bottom' might fix the interactivity

We also have this separate notebook focused entirely on hvplot https://tutorial.xarray.dev/intermediate/hvplot.html !

scottyhq avatar Jul 02 '24 18:07 scottyhq

I think the current changes is a better example to highlight hvPlot's capabilities, and I'd be happy for this to be merged when you think it's ready.

For the existing case, it seems that just removing widget_location='bottom' might fix the interactivity

Yes. I think it might squish the plot a bit too much, but a line plot is still readable.

We also have this separate notebook focused entirely on hvplot https://tutorial.xarray.dev/intermediate/hvplot.html !

Would you like me to try revising that too? Particularly, I think it can also show other type of plots.

ahuang11 avatar Jul 02 '24 18:07 ahuang11

I think the current changes is a better example to highlight hvPlot's capabilities, and I'd be happy for this to be merged when you think it's ready.

I really like that the new plot is interactive both on the website and the notebook. It is however a bit complicated. I'd suggest keeping the "Xarray in 45 minutes" example super simple (otherwise when presenting these notebooks in tutorial settings you get lots of questions).

Would you like me to try revising that too? Particularly, I think it can also show other type of plots.

How about your original suggestion of just embedding a couple time slices in the overview notebook and adding this new excellent example of grouping by season and latitude in the 'intermediate' notebook? For this new example and any others you'd like to add please explain what each keyword is doing and link to the relevant upstream docs (here https://hvplot.holoviz.org/user_guide/Customization.html#generic-options ?)

scottyhq avatar Jul 03 '24 16:07 scottyhq