variable transparency in surface plot
13 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
I'm trying to represent as a colored planar surface in 3d and would like to use variable transparency across the entries using the surface command. If 'CData' is an array of size m x n x 3, does 'AlphaData' have to be three-dimensional as 'CData' or of size m x n?
The following code does not produce the intended result for 2-dimensional 'AlphaData' and makes matlab crash after executing the program if I use a 3d array for 'AlphaData':
CData = rand(4,4,3); % random color data
[X,Y] = meshgrid(0:0.25:1,0:0.25:1);
Z = zeros(size(X));
figure(1)
clf
h0 = surface(X,Y,Z,'CData',CData,'FaceColor','texturemap')
h1 = surface(X,Y,Z+1,'CData',CData,'FaceColor','texturemap')
view(10,60)
AlphaData = ones(4);
AlphaData(2:3,2:3)=.5;
set(h0,'Alphadata',AlphaData,'FaceAlpha','texturemap')
set(h1,'Alphadata',AlphaData,'FaceAlpha','texturemap')
Any helpful hints as to what goes wrong would be very much appreciated.
2 Commenti
Risposte (1)
Walter Roberson
il 21 Apr 2014
AlphaData must be two dimensional.
For FaceColor of 'texturemap', CData does not need to be the same size as the ZData: it will be "stretched" to fit the ZData.
For FaceAlpha of 'texturemap', AlphaData does not need to be the same sze as the ZData or the CData: it will be "stretched" to fit the ZData.
Vedere anche
Categorie
Scopri di più su Surface and Mesh Plots in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!