Multiple colormaps with surface and patch

2 Ansichten (letzte 30 Tage)
Simone
Simone am 1 Sep. 2011
Hi all...
My question is a variation on the theme of the use of the multiple colormap on the same figure/axis, but with the additional issue of handling a surface and a patch at the same time...
I have to display an image (an ortophoto) overlapped to a 3D surface (a digital elevation model of the land) and, at the same time a patched section (an isocap) of a volume of a certain variable (the salinity) simulated by a oceanographyc model.
I cannot use the common geoshow or mapshow commands to display the geotiff image because of the 3D view and the need to overlap it on a 3D surface. I have to use the command "surface" with the texturemap option.
So:
Let's load the image:
% Loading ortophoto
[Orto, R, bbox] = geotiffread('.\GIS\Geotiff.tif');
% Convert to index color data to display as a texture map
[Co,map] = rgb2ind(Orto(:,:,1:3),256);
Let's assume that 'Zo' is the surface 3D data, with his corresponding Xo and Yo coordinate grids.
Let's plot the overlapped image on the surface data:
Ort = surface(Xo,Yo,Zo,Co,'FaceColor','texturemap','EdgeColor','none',...
'CDataMapping','direct');
and let's apply the proper colormap.
colormap(map)
Now let's display the section "Ssect" (isocap):
c = patch(Ssect,'FaceColor','interp','EdgeColor','none');
and let's apply its proper colormap:
colormap(hsv)
As known, the last "colormap" command overwrite the first one.
I tried to apply the product support answer http://www.mathworks.es/support/tech-notes/1200/1215.html and the other http://www.mathworks.es/help/techdoc/creating_plots/bqsxy8a-1.html#brdjjbz-1, but they are not directly appliable to patch surface.
I can understand the principle to break the colormap and reserve part of it for one element and part for another one, but I don't know how to do it when facing with a surface and a patch at the same time.
Please note that the first colormap (map) is not a linearly varying standard colormap but a discrete-values colormap deriving from the coding of RGB values of the image.
Thanks in advance
Simone

Antworten (3)

Bjorn Gustavsson
Bjorn Gustavsson am 1 Sep. 2011
TCOLOR is a tool which replaces pcolor/surf for rgb-images, FREEZECOLORS makes it possible to use multiple colormaps in one figure, and the same capability exists in the COLORMAP-AND-COLORBAR-UTUILITIES.
If the worst comes to the worst maybe you simply have to plot the orto-photo pixel-by-pixel as patches with their facecolor set to the RGB values - unreasonably tedious but shold get the job done.
HTH.

Walter Roberson
Walter Roberson am 1 Sep. 2011
Is there a particular reason why the geotiff image must be converted to pseudocolor? surface() accepts truecolor (RGB) data for the color property.

Simone
Simone am 21 Sep. 2011
THANK you!!!! Sorry for my late answer.... Actually I cannot use freezecolors with surface, patch and pseudocolor surface together, but, with Walter's suggestion (to keep the original RGB data), I can employ the freezecolor and colormap/bar utilities successfully....
Thank you so much... Simone

Produkte

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by