matplotlib / matplotlib/matplotlib
[Bug]: pyplot.quiverkey does not work as expected with polar subplots
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 23.2k
- Forks
- 8.5k
- Avg merge
- 1d 6h
- Merged PRs (30d)
- 66
Description
### Bug summary
`pyplot.quiverkey` does not work correctly in polar plots.
### Code for reproduction
```python
import numpy as np
from matplotlib import pyplot as plt
fig, ax = plt.subplots(subplot_kw={"polar": True})
longitude = np.arange(0, 360, 10)
colatitude = 90 - np.ones_like(longitude) * 60
sample_x = np.ones_like(longitude) # Northward
sample_y = np.zeros_like(longitude) # Eastward
q = ax.quiver(np.radians(longitude), colatitude, sample_y, -sample_x, angles="xy")
ax.quiverkey(q, X=0, Y=0, U=5, label='5 units')
```
### Actual outcome

### Expected outcome
The quiverkey should be a single line rather than a cartwheel.
### Additional information
_No response_
### Operating system
macOS Ventura 13.5
### Matplotlib Version
3.7.1
### Matplotlib Backend
Installed osx event loop hook. MacOSX
### Python version
3.10.11
### Jupyter version
4.0.1
### Installation
conda
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by running the provided Python reproduction with a polar subplot and inspect the pyplot.quiverkey path and related quiver-key handling. Compare the polar result with a non-polar plot; done means the polar quiver key renders as one line rather than a cartwheel while preserving the expected 5-unit label.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- data-visualization
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100