Matlab: How to assign different colormaps/colorbars to different surfaces in the same Figure -


i new matlab , have few questions. got 2 surfaces , plane in same figure. want use different colormap , colorbar b , colormap , colorbar c. s fixed color it's not problem.

let me try explain trying achieve:

cmap1=colormap(topobathy) -->cmap1 64x3 double expected

cmap2=colormap(redwhitegreen)

create cdata1 using cmap1 (this first part cannot figure out, how scale z data using cmap1, default cdata contains z values)

b=surf(x,y,z,cdata1)

colorbar b using z values

c=pcolor(x,y,(z-z0)) - want use cmap2 one.

colorbar c using (z-z0) values

here have far , problems encounter

b=surf(x,y,z); colormap(topobathy); cbar1=colorbar; set(get(cbar1,'ylabel'),'string', 'elevation (m)', 'rotation', 90) hold on; s=surf(x,y,z1,'facecolor',[0.278 0.788 0.788]) hold on; change=z-z0;      c=pcolor(x,y,change) set(c,'zdata',100 + 0*change); %plotting above other surfaces colormap(redwhitegreen)` 

at point colormap set redwhitegreen b, colorbar of b can't second colorbar own clim etc.

i used freezecolors , cbfreeze explained in link: http://blogs.mathworks.com/pick/2009/07/24/using-multiple-colormaps-in-a-single-figure/

but 1 thing works while messing thing (probably fault). want learn how have complete control on objects without using external m files anyway.

any appreciated.

the basic idea concatenate colormaps, , shift/scale color data (cdata) of different plot handles line desired portions of colormap. so, without knowing custom functions or specific data are, colormap(topobathy(64); redwhitegreen(64)) , scale cdata of b range [1,64] , cdata of c range [65,128].

there excellent guide on mathworks website explains (even uses surf() , pcolor() example):

http://www.mathworks.com/support/tech-notes/1200/1215.html#example_1

for colorbar, can fake out ticks , labels in similar manner. here rough shot @ making color bar above example:

h = colorbar; ticks = [1 16:16:64 64:16:128]; ticks(5:6) = [62 66]; set(h, 'ytick', ticks);  labels = num2str(repmat(linspace(min(z(:)), max(z(:)), 5), 1, 2)', 2); set(h, 'yticklabel', labels) 

enter image description here


Comments

Popular posts from this blog

basic authentication with http post params android -

vb.net - Virtual Keyboard commands -

How to get multiresult with multicondition in Sql Server -