Skip to content

Radial grid missing in polar plots with ax.set_theta_direction(-1) and ax.set_theta_zero_location #20388

@olehy

Description

@olehy

When creating a polar plot with inverted theta direction and modifying the location of zero, the radial grid and outer boundary are missing for some locations of zero.

import numpy as np
import matplotlib.pyplot as plt

r = np.arange(0, 2, 0.01)
theta = 2 * np.pi * r

fig, ax = plt.subplots(subplot_kw={'projection': 'polar'})
ax.plot(theta, r)

ax.set_theta_direction(-1)

angle = 10 # 20 is not working, 10 is working
ax.set_theta_zero_location("N",angle) 
plt.savefig('expected-outcome.png')

angle = 20 # 20 is not working, 10 is working
ax.set_theta_zero_location("N",angle) 
plt.savefig('actual-outcome.png')

This is the outcome (can be reproduced with angle=20):
actual-outcome

And this is what it should look like (can be reproduced with angle=10):
expected-outcome

import matplotlib
print(matplotlib.__version__)
import platform
print(platform.python_version())
3.4.2
3.9.2

When I go back to matplotlib release v3.2.2 I don't have this issue.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions