matplotlib / matplotlib/matplotlib
bad autoscale_view() with long curved FancyArrowPatch
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 23.2k
- Forks
- 8.5k
- Avg merge
- 1d 6h
- Merged PRs (30d)
- 66
Description
### Bug report
When using a very long `FancyArrowPatch` with `connectionstyle="arc3"`, subsequent axes autoscaling can badly squash the figure's content. Example below exhibits the problem, but more extreme squashing can easily be obtained. Possibly this is not limited to `FancyArrowPatch`?
**Code for reproduction**
```python
import matplotlib
import matplotlib.pyplot as plt
fap = matplotlib.patches.FancyArrowPatch(
(10, 10),
(20, 2e4),
mutation_scale=50,
connectionstyle="arc3,rad=0.3",
)
_, ax = plt.subplots()
ax.add_patch(fap)
ax.set_title(f"matplotlib {matplotlib.__version__}")
ax.autoscale_view()
ax.figure.savefig("curved-arrow.png")
```
**Actual outcome**

**Expected outcome**
The axes view should span the drawn content. Any control point(s) required for the arc should be ignored.
**Matplotlib version**
* Operating system: Linux
* Matplotlib version: 3.3.4
* Matplotlib backend: Reproducible with at least `GTK3Agg` and `agg`.
* Python version: 3.9
Matplotlib installed via pip.
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 with the reproduction code using FancyArrowPatch, connectionstyle="arc3", and ax.autoscale_view(), then trace the FancyArrowPatch and autoscale_view entry points. Confirm the behavior with the supplied example and determine how control points affect the calculated view limits. Done means the axes span the drawn content without being badly squashed, with regression coverage for the example.
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