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
Description
I guess this is not a bug, but I rather miss something, so I just formulate this as a question:
How can I set individual facecolors when plotting withplot_trisurf
?
Here's a modified version ofthis example:
from mpl_toolkits.mplot3d import Axes3Dimport matplotlib.pyplot as pltimport numpy as npn_radii = 8n_angles = 36# Make radii and angles spaces (radius r=0 omitted to eliminate duplication).radii = np.linspace(0.125, 1.0, n_radii)angles = np.linspace(0, 2*np.pi, n_angles, endpoint=False)# Repeat all angles for each radius.angles = np.repeat(angles[..., np.newaxis], n_radii, axis=1)# Convert polar (radii, angles) coords to cartesian (x, y) coords.# (0, 0) is manually added at this stage, so there will be no duplicate# points in the (x, y) plane.x = np.append(0, (radii*np.cos(angles)).flatten())y = np.append(0, (radii*np.sin(angles)).flatten())# Compute z to make the pringle surface.z = np.sin(-x*y)fig = plt.figure()ax = fig.gca(projection='3d')# my changes:c = ((1, 0.0, 0.0),(0.0, 1.0, 0.0))ax.plot_trisurf(x, y, z, linewidth=0.2, antialiased=True, edgecolors=c, facecolors=c) modified this lineplt.show()
The edge colors are set as expected, but the face colors are unaffected and displayed with the default blue color.
Regards