Thread Subject: Legend for Pcolor

Subject: Legend for Pcolor

From: Nathan

Date: 21 Oct, 2008 02:06:02

Message: 1 of 3

I have been using pcolor to plot my data which has already been compressed to discrete values normally ranging from 0-6. The commands are just

pcolor(mymatrix) %with discrete values ranging from 0 to 6
colormap(grey(7))

I would like to have a legend with entries for each discrete value and have had no luck with the following:

legend('LabelFor0','LabelFor1','LabelFor2','LabelFor3'....

Does anyone know how to get a legend like that to work with pcolor?

Thanks

Subject: Legend for Pcolor

From: Steven Lord

Date: 21 Oct, 2008 13:14:27

Message: 2 of 3


"Nathan " <natepatterson9@hotmail.com> wrote in message
news:gdjdea$5hv$1@fred.mathworks.com...
>I have been using pcolor to plot my data which has already been compressed
>to discrete values normally ranging from 0-6. The commands are just
>
> pcolor(mymatrix) %with discrete values ranging from 0 to 6
> colormap(grey(7))
>
> I would like to have a legend with entries for each discrete value and
> have had no luck with the following:
>
> legend('LabelFor0','LabelFor1','LabelFor2','LabelFor3'....
>
> Does anyone know how to get a legend like that to work with pcolor?

What you're describing sounds more like a COLORBAR than a legend.

--
Steve Lord
slord@mathworks.com

Subject: Legend for Pcolor

From: Nathan

Date: 21 Oct, 2008 17:32:02

Message: 3 of 3

"Steven Lord" <slord@mathworks.com> wrote in message <gdkkjj$p40$1@fred.mathworks.com>...
>
> "Nathan " <natepatterson9@hotmail.com> wrote in message
> news:gdjdea$5hv$1@fred.mathworks.com...
> >I have been using pcolor to plot my data which has already been compressed
> >to discrete values normally ranging from 0-6. The commands are just
> >
> > pcolor(mymatrix) %with discrete values ranging from 0 to 6
> > colormap(grey(7))
> >
> > I would like to have a legend with entries for each discrete value and
> > have had no luck with the following:
> >
> > legend('LabelFor0','LabelFor1','LabelFor2','LabelFor3'....
> >
> > Does anyone know how to get a legend like that to work with pcolor?
>
> What you're describing sounds more like a COLORBAR than a legend.
>
> --
> Steve Lord
> slord@mathworks.com
>


Thank you, it's exactly what I was looking for.

Tags for this Thread

Everyone's Tags:

Add a New Tag:

Separated by commas
Ex.: root locus, bode

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.

Tag Activity for This Thread
Tag Applied By Date/Time
pcolor Nathan 20 Oct, 2008 22:10:06
legend Nathan 20 Oct, 2008 22:10:06
rssFeed for this Thread

Contact us at files@mathworks.com