Skip to content

[Bug]: Removing spines in polar plot causes distortion of the plot #30164

@sjbabdi

Description

@sjbabdi

Bug summary

I would like to create a polar plot without the grid lines. When using ax.set_xticks([]) (and/or yticks/rticks) the plot appears distorted.

Code for reproduction

import numpy as np
import matplotlib.pyplot as plt

D = np.array([[2,.3],[.3,2.5]])

# creating an ellipse)
lam, vec = np.linalg.eigh(D)
theta    = np.linspace(-np.pi,np.pi,1001)
xy       = np.stack((lam[0]*np.cos(theta), lam[1]*np.sin(theta)), axis=0)
xy       = vec.T@xy
radii    = np.sqrt(np.sum(xy**2, axis=0))
thetas   = np.arctan2(-xy[1],xy[0])

plt.figure()
# with ticks
ax1 = plt.subplot(121,projection='polar')
ax1.plot(thetas, radii)
# without ticks
ax2 = plt.subplot(122, projection='polar')
ax2.plot(thetas, radii)
ax2.set_yticks([])
ax2.set_xticks([])

plt.show()

Actual outcome

Image

Expected outcome

Image

Additional information

No response

Operating system

OS/X and Linux

Matplotlib Version

3.10.0

Matplotlib Backend

module://matplotlib_inline.backend_inline

Python version

3.10

Jupyter version

No response

Installation

None

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions