Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork7.9k
Open
Labels
Description
Bug summary
When usingshading='gouraud'
with tripcolour on an axis with polar projection, the data does not plot correctly.
Code for reproduction
importnumpyasnpimportpyvistaaspvfromscipy.spatialimportDelaunayimportmatplotlib.pyplotaspltfrommatplotlib.triimportTriangulation# create disk meshdisk=pv.Disc(center=(0.,0.,0.),inner=1.22,outer=2.22,normal=(0.,0.,1.),r_res=64,c_res=360)points=disk.points[:,:2]# create sample datadata=np.exp(-np.power((np.linalg.norm(points,axis=1)-1.72)/0.25,2.)/2.)# triangulatetess=Delaunay(points)r=np.linalg.norm(points,axis=1)theta=np.arctan2(points[:,1],points[:,0])triang=Triangulation(x=theta,y=r,triangles=tess.simplices)fig,ax=plt.subplots(1,2,subplot_kw={'projection':'polar'})ax[0].tripcolor(triang,data,shading='gouraud')ax[0].set_title('gouraud')ax[1].tripcolor(triang,data,shading='flat')ax[1].set_title('flat')plt.show()
Actual outcome
As can be seen in the image produced by the code, Gouraud shading (left) does not properly plot in polar coordinates. Flat shading (right) works as expected.
Expected outcome
The left plot should look basically the same as the right plot.
Additional information
As far as I know, this worked fine about a month ago. However, when I reverted my Python environment to one from March, the issue persisted.
Operating system
Reproduced on both macOS and Windows
Matplotlib Version
3.8.4
Matplotlib Backend
MacOSX
Python version
3.11.8
Jupyter version
No response
Installation
conda