Open
Description
Bug summary
When using shading='gouraud'
with tripcolour on an axis with polar projection, the data does not plot correctly.
Code for reproduction
import numpy as np
import pyvista as pv
from scipy.spatial import Delaunay
import matplotlib.pyplot as plt
from matplotlib.tri import Triangulation
# create disk mesh
disk = 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 data
data = np.exp( - np.power((np.linalg.norm(points, axis=1) - 1.72) / 0.25, 2.) / 2.)
# triangulate
tess = 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