From: Monica Wolfson on
Hi All,
I need to flip the order of colors in my colorbar. In an online search, all I have found is a way to flip the actual colormap colors. This is not what I want to do. Right now I am mapping temperature using the colormap Jet. Cooler temps are blue and warmer are red. The top of my plot is at 0 degrees and it goes down to 1300 degrees. So I have blue on top and red on bottom. I want my colorbar to be the same, but it plots with red on top and blue on bottom. I need the color labels and color orders to be flipped.

I tried

h = colorbar
set(h,'YDir','reverse')

but this does not seem to work, though no error message is returned.

Any help would be appreciated.

Thanks,
Monica
From: Ravi ch on
monica

this shud work ...


fig = figure(1)
colorbar
mycmap = get(fig,'Colormap')
set(fig,'Colormap',flipud(mycmap))



"Monica Wolfson" <mwollfson(a)ccom.unh.edu.remove.this> wrote in message <hkf726$fsa$1(a)fred.mathworks.com>...
> Hi All,
> I need to flip the order of colors in my colorbar. In an online search, all I have found is a way to flip the actual colormap colors. This is not what I want to do. Right now I am mapping temperature using the colormap Jet. Cooler temps are blue and warmer are red. The top of my plot is at 0 degrees and it goes down to 1300 degrees. So I have blue on top and red on bottom. I want my colorbar to be the same, but it plots with red on top and blue on bottom. I need the color labels and color orders to be flipped.
>
> I tried
>
> h = colorbar
> set(h,'YDir','reverse')
>
> but this does not seem to work, though no error message is returned.
>
> Any help would be appreciated.
>
> Thanks,
> Monica
From: Monica Wolfson on
Thanks Ravi,
Unfortunately this does not work. It actually reverses the colormap in the actual image itself. So now, blue colors are hot temps and red colors are cold. The colorbar colors are indeed flipped (to match the new image), but it flipped the labels with it. So O degrees is now red instead of blue, but is still located at the bottom of the colorbar.

What I would like is to be able to have the colorbar flip the colors but without flipping the colors in the actual image. I want the top of my colorbar to be blue at 0 degrees and the bottom of the colorbar to be red at 1300 degrees. This is why I thought flipping the Y or Z axis of the actual colorbar would work, but it doesn't.


"Ravi ch" <ravi.chilumula(a)gmail.com> wrote in message <hkfes8$a7u$1(a)fred.mathworks.com>...
> monica
>
> this shud work ...
>
>
> fig = figure(1)
> colorbar
> mycmap = get(fig,'Colormap')
> set(fig,'Colormap',flipud(mycmap))
>
>
>
> "Monica Wolfson" <mwollfson(a)ccom.unh.edu.remove.this> wrote in message <hkf726$fsa$1(a)fred.mathworks.com>...
> > Hi All,
> > I need to flip the order of colors in my colorbar. In an online search, all I have found is a way to flip the actual colormap colors. This is not what I want to do. Right now I am mapping temperature using the colormap Jet. Cooler temps are blue and warmer are red. The top of my plot is at 0 degrees and it goes down to 1300 degrees. So I have blue on top and red on bottom. I want my colorbar to be the same, but it plots with red on top and blue on bottom. I need the color labels and color orders to be flipped.
> >
> > I tried
> >
> > h = colorbar
> > set(h,'YDir','reverse')
> >
> > but this does not seem to work, though no error message is returned.
> >
> > Any help would be appreciated.
> >
> > Thanks,
> > Monica
 | 
Pages: 1
Prev: Active x in simulink
Next: using mod