Skip to content

Issue rendering polar plot (agg backend?) with rorigin set #17418

Closed

Description

@NelleV

Bug report

When saving a png of a polar plot with the r-origin set "by hand," saving the result as a png plot doesn't work as expected. Saving it as PDF works as expected. Working interactively and saving it with the UI as a png works as expected.

import matplotlib.pyplot as plt
import numpy as np
from matplotlib.gridspec import GridSpec

nbins = 50
data = np.random.randint(0, 42, nbins)

fig = plt.figure()

ax_g = fig.add_subplot(polar=True, facecolor="none")
theta = np.array(
    [np.pi/2-i*2*np.pi/len(data) for i in range(len(data))])
lines = ax_g.plot(theta, data)

ax_g.set_rorigin(-78)  # Replacing this with ax_g.set_rmin works as expected, so the problem comes from this line.

fig.savefig("bug.png")
fig.savefig("bug.pdf")

Actual outcome

bug

Expected outcome

bug.pdf

Matplotlib version

  • Operating system: Ubuntu
  • Matplotlib version: 3.2.1
  • Matplotlib backend (print(matplotlib.get_backend())): TkAgg (tried with Agg, and other backends)
  • Python version: 3.8.2
  • Jupyter version (if applicable): NA
  • Other libraries:  NA
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions