matplotlib / matplotlib/matplotlib

Polar plot label rotation ignored

Open
#10,882 11 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

keep status: confirmed bug topic: polar
Dominant language
Python
Stars
23.2k
Forks
8.5k
Avg merge
1d 6h
Merged PRs (30d)
66

Description

### Bug report

**Bug summary**

In matplotlib 2.0.2 you could rotate the axes labels on a polar plot, just as with any other plot

```python
for i, label in enumerate(ax.get_xticklabels()):
label.set_rotation(i*90)
```
This is not possible anymore with matplotlib 2.2.2

**Code for reproduction**

```python
import matplotlib
import numpy as np
import matplotlib.pyplot as plt

fig=plt.figure(figsize=(4,3))
ax = plt.subplot(111, polar=True)
ax.set_xlabel("Matplotlib "+matplotlib.__version__)
ticks = np.arange(3)*np.pi/2.
labels = ["".join([a]*5) for a in list("ABC")]

plt.xticks(ticks, labels, size=16)
for i, label in enumerate(ax.get_xticklabels()):
label.set_rotation(i*90)

plt.tight_layout()
plt.show()
```

**Actual outcome with matplotlib 2.2.2**

The rotation of the labels is simply ignored.

![image](https://user-images.githubusercontent.com/23121882/37921566-79924afa-312a-11e8-8df3-99ed09e144c3.png)

**Expected outcome (as with 2.0.2)**

We would expect to see the labels rotated as in this plot, produced by the same code run on matplotlib 2.0.2.

![image](https://user-images.githubusercontent.com/23121882/37921624-a499bdfa-312a-11e8-867c-f95dd119ec04.png)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by running the provided polar-plot reproduction script with matplotlib 2.2.2 and inspect how polar axes create and draw their x tick labels. Done means label.set_rotation(i*90) visibly affects the labels as it did in matplotlib 2.0.2, without breaking the shown plot behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
data-visualization
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.