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:
How do I set colorbar min max?

Subject: How do I set colorbar min max?

From: Florian

Date: 7 Feb, 2008 15:34:03

Message: 1 of 3

Hey everyone,

how can I code my own limits in the colorbar of a figure???
I've think CLim should do the job, but I have got no clue
how to apply it! :/

Thanks for your help everyone,
Florian

Subject: How do I set colorbar min max?

From: Arthur G

Date: 7 Feb, 2008 21:28:12

Message: 2 of 3

On Thu, 07 Feb 2008 10:34:03 -0500, Florian <flowwiththeflo@hotmail.com>
wrote:
> Hey everyone,
>
> how can I code my own limits in the colorbar of a figure???
> I've think CLim should do the job, but I have got no clue
> how to apply it! :/
>
> Thanks for your help everyone,
> Florian

When you add a colorbar to an axis in a figure, the limits are taken from
CLim. So you need to change CLim on the axis before displaying the color
bar, e.g.:

set(gca, 'CLim', [cLow, cHigh]);

If you don't want to limits of the colorbar to match those of the axis,
you'll have to add another axis to the figure with the desired value of
CLim and add the colorbar to it.

There's an example under CLim in the Matlab documentation that shows how
to "fake" one colorbar for two axes.

--Arthur

Subject: How do I set colorbar min max?

From: Tord

Date: 16 Jul, 2012 09:19:07

Message: 3 of 3

Ah, thanks Arthur!
Just what I needed!

"Arthur G" <gorramfreak+news@gmail.com> wrote in message <op.t56a9a0o1g2ca1@whitaker-four-ninety-one.mit.edu>...
> On Thu, 07 Feb 2008 10:34:03 -0500, Florian <flowwiththeflo@hotmail.com>
> wrote:
> > Hey everyone,
> >
> > how can I code my own limits in the colorbar of a figure???
> > I've think CLim should do the job, but I have got no clue
> > how to apply it! :/
> >
> > Thanks for your help everyone,
> > Florian
>
> When you add a colorbar to an axis in a figure, the limits are taken from
> CLim. So you need to change CLim on the axis before displaying the color
> bar, e.g.:
>
> set(gca, 'CLim', [cLow, cHigh]);
>
> If you don't want to limits of the colorbar to match those of the axis,
> you'll have to add another axis to the figure with the desired value of
> CLim and add the colorbar to it.
>
> There's an example under CLim in the Matlab documentation that shows how
> to "fake" one colorbar for two axes.
>
> --Arthur

Tags for this Thread

No tags are associated with 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