Skip to content

Add Dataset.plot.streamplot() method #5003

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Mar 30, 2021

Conversation

johnomotani
Copy link
Contributor

@johnomotani johnomotani commented Mar 5, 2021

Since @dcherian added Quiver plots in #4407, it's fairly simple to extend the functionality to streamplot().

For example (copying from @dcherian's unit test setup)

import xarray as xr
from matplotlib import pyplot as plt

das = [
    xr.DataArray(
        np.random.randn(3, 3),
        dims=["x", "y"],
        coords=[range(k) for k in [3, 3]],
    )
   for _ in [1, 2]
]
ds = xr.Dataset({"u": das[0], "v": das[1]})
ds["mag"] = np.hypot(ds.u, ds.v)
ds.plot.streamplot(x="x",y="y",u="u",v="v", hue="mag")
plt.show()

streamplot

  • Tests added
  • Passes pre-commit run --all-files
  • User visible changes (including notable bug fixes) are documented in whats-new.rst
  • New functions/methods are listed in api.rst

streamplot needs to use separate condition to one for quiver plots.
Copy link
Collaborator

@mathause mathause left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Could you fix the conflict then I am happy to merge. Unless @dcherian wants to have a look?

@johnomotani
Copy link
Contributor Author

Thanks @mathause - I've merged master now.

@dcherian
Copy link
Contributor

Thanks @johnomotani & @mathause

@dcherian dcherian merged commit ba47216 into pydata:master Mar 30, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants