Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
two different colorbars for two contourfs in one figure

Subject: two different colorbars for two contourfs in one figure

From: edward kabanyas

Date: 27 Mar, 2012 13:37:12

Message: 1 of 3

Hi All,

I want to make two contourf plots with two different colorbars, the first is Jet and the second is gray type. However, it always changes; when I change the colorbar to gray, both figures are gray, and vice versa. Any idea or experience to do it ? Thanks for sharing...

Edward

Subject: two different colorbars for two contourfs in one figure

From: Steven_Lord

Date: 27 Mar, 2012 13:43:21

Message: 2 of 3



"edward kabanyas" <djuky_hmi@yahoo.com> wrote in message
news:jksfq8$r55$1@newscl01ah.mathworks.com...
> Hi All,
>
> I want to make two contourf plots with two different colorbars, the first
> is Jet and the second is gray type. However, it always changes; when I
> change the colorbar to gray, both figures are gray, and vice versa. Any
> idea or experience to do it ? Thanks for sharing...

http://www.mathworks.com/support/solutions/en/data/1-GNRWEH/index.html

--
Steve Lord
slord@mathworks.com
To contact Technical Support use the Contact Us link on
http://www.mathworks.com

Subject: two different colorbars for two contourfs in one figure

From: edward kabanyas

Date: 27 Mar, 2012 21:26:16

Message: 3 of 3

hi steven;

Thanks for reply, I have studied the example that you sent. However, it is different from my case. I need two independent colorbars for two contour plot, not sharing a colorbar for two plots as in example. In the example the colorbar is only one and "Z data" is the same for both plots.

For example, I have two day observation data and assumed as data1 and data2,
x = time,
y = location
z1 = wind of first day (data1)

x = time,
y = location
z2 = wind of second day (data2)

I plotted as

cmap1 = jet(32);
cmap2 = gray(32);
myColorMap = [cmap1;cmap2];


axes('position',[0.16 0.19 0.34 0.74])
contourf(x, y, z1)
colormap(myColorMap(1:32,:)); % hope to get jet plot

  
axes('position',[0.16 0.19 0.34 0.74])
contour(x,y,z2)
colormap(myColorMap(33:end,:)); % hope to get gray

z1min = 15, z1max = -15
z2min = 20, z2max = 100;

Probably you have another idea, thanks for help



 



"Steven_Lord" <slord@mathworks.com> wrote in message <jksg5r$sdr$1@newscl01ah.mathworks.com>...
>
>
> "edward kabanyas" <djuky_hmi@yahoo.com> wrote in message
> news:jksfq8$r55$1@newscl01ah.mathworks.com...
> > Hi All,
> >
> > I want to make two contourf plots with two different colorbars, the first
> > is Jet and the second is gray type. However, it always changes; when I
> > change the colorbar to gray, both figures are gray, and vice versa. Any
> > idea or experience to do it ? Thanks for sharing...
>
> http://www.mathworks.com/support/solutions/en/data/1-GNRWEH/index.html
>
> --
> Steve Lord
> slord@mathworks.com
> To contact Technical Support use the Contact Us link on
> http://www.mathworks.com

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us