-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
[Bug]: Polar plot wrong Y values when set_ylim is used #24790
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Weird - I can reproduce this on the current |
Although I think the second line is rendered at r=5, not r=13 - can you confirm if that's correct for you too? |
@dstansby Thanks for the quick reply! |
Ah, I was using different y-lims, I think the line is being moved to the lower ylim + 5 (which in the original post case is 8 + 5 = 13). |
Here's a slightly simpler example (sorry for the train of thought comments, but hopefully helpful!) import numpy
import matplotlib.pyplot as plt
x = numpy.linspace(0, numpy.pi/2., num=90)
y = numpy.full(90, 5)
fig, ax = plt.subplots(subplot_kw={'projection': 'polar'})
ax.set_ylim(4, 10)
# Line drawn correctly at y=5
ax.plot(x, y)
fig.canvas.draw()
# Line now drawn incorrectly at y=1
ax.set_ylim(0, 10)
plt.show() |
I can't reproduce the original example because of an exception, |
|
Bug summary
Plotting 2 trivial lines in a polar axes. Those lines are quarter-arcs with constant y values:
The figure is plotted using a
canvas.draw()
call.If line1 is deleted,
set_ylim(8, 10)
will make line2 disappear. In fact it can be found at y=13 for some reason.Inspecting the object values (get_data) returns the correct values. It is as if the data was correct but the rendering off by just "4"
The issue is that
set_ylim
on a polar plot seems to apply an offset on the remaining lines after some workflow.Code for reproduction
See simpler example at #24790 (comment)
Actual outcome
line2 rendering is done as if line2 had all its y values = 13
Expected outcome
line2 should be rendered as a if its values were y=9 (same as get_data return values)
Additional information
Operating system
Debian 11.6
Matplotlib Version
3.3.4; 3.4.2; 3.5.3; 3.6.2
Matplotlib Backend
tkAgg; Qt5Agg
Python version
3.7.10; 3.9.2
Jupyter version
No response
Installation
Linux package manager
The text was updated successfully, but these errors were encountered: