Skip to content

Commit

Permalink
Fix streamplot on non-cartopy axes (#24).
Browse files Browse the repository at this point in the history
Apparently streamplot needs all variables (including coords) as numpy arrays,
not xarray data arrays. Why this issue is only showing up on non-cartopy axes
(and thus related to #24) is complete mistery to me.
  • Loading branch information
juseg committed Oct 16, 2022
1 parent a668860 commit 3c561c9
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion hyoga/plot/datasets.py
Expand Up @@ -346,10 +346,11 @@ def surface_velocity_streamplot(self, **kwargs):
# streamplot surface velocity
try:
return ax.streamplot(
uvar.x, uvar.y, uvar.to_masked_array(), vvar.to_masked_array(),
uvar.x.data, uvar.y.data, uvar.data, vvar.data,
color=cvar.to_masked_array(), norm=norm, **style)

# streamplot colormapping fails on empty arrays (mpl issue #19323)
# (this is fixed in matplotlib 3.6.0, released Sep. 2022)
except ValueError:
return None

Expand Down

0 comments on commit 3c561c9

Please sign in to comment.