Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork7.9k
Description
Bug summary
Plotting 2 trivial lines in a polar axes. Those lines are quarter-arcs with constant y values:
- line1 is only y=5
- line2 is only y=9
The figure is plotted using acanvas.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 thatset_ylim
on a polar plot seems to apply an offset on the remaining lines after some workflow.
Code for reproduction
importnumpyimportmatplotlib.pyplotaspltx=numpy.linspace(0,numpy.pi/2.,num=90)y1=numpy.full(90,5)y2=numpy.full(90,9)fig,ax=plt.subplots(subplot_kw={'projection':'polar'})ax.set_xlim(0,numpy.pi/2.)ax.set_ylim(4,10)ax.plot(x,y1)ax.plot(x,y2)fig.canvas.draw()ax.lines.pop(0)# If popping the 2nd line no issue encounteredifTrue:ax.set_ylim(8,10)# This moves the 2nd line from y=9 to y=13plt.show()
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
- Deleting the other line instead gives no issue. Only deleting a line that contains data inferior to every other lines triggers the issue
- Not calling canvas.draw before is not an option: My application is interactive the user is able to delete/add lines interactively
- The issue seems to come from set_ylim on a polar plot
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