[Matplotlib-users] Transparency for pcolor slices in Axes3D plot

Thibaut Appel t.appel17 at imperial.ac.uk
Fri Mar 20 10:34:36 EDT 2020


Dear matplotlib users/developers,

I struggle to set some transparency in an Axes3D plot with series of 
2D-slices generated with pcolor. In spite of trying to set alpha, all 
the slices remain opaque. I've just posted the issue on stackoverflow 
<https://stackoverflow.com/questions/60776103/how-to-enforce-transparency-for-pcolor-slices-within-axes3d-scope>, 
where you can see an illustration of the problem. Would someone have a 
workaround?

|import numpy as np|
|import matplotlib.pyplot as plt|
|from mpl_toolkits.mplot3d import Axes3D|
|from matplotlib.collections import PolyCollection|
||
|X, Y = np.meshgrid(x,y)|
||
|fig = plt.figure()|
|ax = fig.gca(projection='3d')|
||
|alpha = 0.8|
||
|for i in range(len(islices)):|
|    im = ax.pcolor(X,Y,u[islices[i],:,:]) #,alpha=alpha)|
|    #im.set_facecolor((0, 0, 1, alpha))|
|||ax.add_collection3d(im,zs=xslices[i],zdir='y')||
|

|plt.show()|


Thank you in advance.
||

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/matplotlib-users/attachments/20200320/6481072f/attachment-0001.html>


More information about the Matplotlib-users mailing list