How to set colormap for a 3D surface that is projected onto the XY Plane?
Mostra commenti meno recenti
Recently, I asked a question on improving the performance of plotting functions like barh. The solution is very time efficient (about 150 times faster than barh), but I find it difficult to set the colormap for the surface https://www.mathworks.com/matlabcentral/answers/414253-why-do-plotting-functions-like-bar-or-barh-take-a-long-time-to-execute.
The code provided in the answer creates a 3D surface and projects it onto XY Plane to create the stacked bar graph.This projection has the correct length for every patch, but the color order changes from what I define. The graph has around 100 patches in the XY projection and I use only two colors based on a certain criteria defined by the identf vector. The resulting figure patches don't have the same color ordering as what I defined in the col matrix. I suspect this has to do with the fact that the graph is being projected onto the XY Plane. Note: colormap was not defined in the following figures.
for icol = 1 : length(data)
if identf(icol) == 0
col(icol,1) = 0;
col(icol,2) = 0.7;
col(icol,3) = 0.7;
elseif identf(icol) == 1
col(icol,1) = 0.79;
col(icol,2) = 0.79;
col(icol,3) = 0.79;
end
end
colormap(parent, col);


Risposta accettata
Più risposte (0)
Categorie
Scopri di più su Color and Styling in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!