This seems to be a very basic question, but after reading the help function and searching on the internet, I still cannot find a solution. Excuse me if I missed something obvious here.
Consider following MWE that is meant to plot a 3D figure in polar coordinates, using a colormap and without lines :
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import cm
r=np.linspace(0,1,100)
theta=np.linspace(0,2*np.pi,10000)
R,Theta=np.meshgrid(r,theta)
X,Y=R*np.cos(Theta),R*np.sin(Theta)
Z=R*np.sin(Theta)*np.cos(Theta)
fig=plt.figure(1)
ax=fig.add_subplot(projection='3d')
ax.plot_surface(X,Y,Z,cmap=cm.inferno,linewidth=0)
plt.show()
As you can see in the produced figure, despite asking linewidth=0
and exaggerating the size of the theta
vector, lines are visible on the surface, and the color resolution is bad :
How can I get rid of the white lines, and obtain a smooth surface with a continuously changing color?