how to remove quiverkey in xarray quiver plot

Question:

I have problem with the quiverkey in xarray quiver plot.
In Matlibplot, we need to add quiverkey externally, but in xarray, quiverkey is automatically plotted when calling quiver. For example,

wnd = xr.merge([u, v])
fig, ax = plt.subplots()
wnd_plot  = wnd.plot.quiver(
            x = "latitude", y = "level",
            ax = ax,
            u='v', v='w',
            width=0.0025 ,headaxislength=2,headlength=4,headwidth=4,
            scale=200, colors="dimgray", clip_on = False)
qv_key = ax.quiverkey(wnd_plot, 0.94,1.03,5,r'5',labelpos='N', labelsep =0.05, color='dimgray')

The code above output (please focus only on quiver part):
enter image description here

There are two quiverkeys: the rightmost one is produced by xarray automatically, and the other is qv_key I add externally.

My question is how can I adjust or remove the xarray quiverkey? This quiverkey is ugly and sometimes located out of bounds, which lead to Image size too large error when saving figure.

I used to add a patch above xarray quiverkey, but I would like to know if there is any other clean solution to it.

Thanks in advance.

Asked By: Grace Wang

||

Answers:

Thanks for Mr. Delgado’s comment above. add_guide = False works.
So the code can be written as following:

wnd = xr.merge([u, v])
fig, ax = plt.subplots()
wnd_plot  = wnd.plot.quiver(
            x = "latitude", y = "level",
            ax = ax,
            u='v', v='w',
            width=0.0025 ,headaxislength=2,headlength=4,headwidth=4,
            scale=200, colors="dimgray", clip_on = False, add_guide = False)
qv_key = ax.quiverkey(wnd_plot, 0.94,1.03,5,r'5',labelpos='N', labelsep =0.05, 
                      color='dimgray')
Answered By: Grace Wang
Categories: questions Tags: , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.