Home > Archive > Matlab > June 2007 > Legends for filled contour plots
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Legends for filled contour plots
|
|
| Pradeep 2007-06-29, 7:14 pm |
| Hi,
Could someone tell me how to obtain a legend for (filled) contour
plots using MATLAB. Thanks.
This is what I am doing: from a grid-based computation data (in my
case, FEM), I use patch to plot ``patch graphics" and then use
interpolated shading. Is there someway to make MATLAB show the levels
(of the field values) to which the colors (from shading) correspond?
Is there also a way to control the number of levels in the
interpolated shading?
Thanks again.
- Pradeep
| |
| Francis Burton 2007-06-29, 7:14 pm |
| In article <1183133878.959978.78100@k29g2000hsd.googlegroups.com>,
Pradeep <drppbhat@gmail.com> wrote:
>Could someone tell me how to obtain a legend for (filled) contour
>plots using MATLAB. Thanks.
Does 'colorbar' do what you want?
>This is what I am doing: from a grid-based computation data (in my
>case, FEM), I use patch to plot ``patch graphics" and then use
>interpolated shading. Is there someway to make MATLAB show the levels
>(of the field values) to which the colors (from shading) correspond?
>Is there also a way to control the number of levels in the
>interpolated shading?
From the documentation:
"colormap(hsv(128)) creates an hsv colormap with 128 colors. If you do
not specify a size, MATLAB creates a colormap the same size as the
current colormap."
This assumes equal spacing of you colour-value mapping.
Francis
| |
| Pradeep 2007-06-29, 7:14 pm |
| > Does 'colorbar' do what you want?
Yes, it does. Thanks.
> From the documentation:
> "colormap(hsv(128)) creates an hsv colormap with 128 colors. If you do
> not specify a size, MATLAB creates a colormap the same size as the
> current colormap."
>
> This assumes equal spacing of you colour-value mapping.
I realize that I can add or delete levels (or indexes, as it is called
in MATLAB) by editing colormap through menu bar; however, I would like
to do it from the command line and that too, using my data rather than
the RGB values. Is there a way to do it, i.e., index a colormap by
specifying the CData (again, a MATLAB notation) rather than an array
of RGB values (between 0 and 1)?
- Pradeep
|
|
|
|
|