Color Surface Plot

  • Follow


Greetings,
I am using surfc(x,y,z,colr) to plot a 3D surface with good success.
I am having problems controlling the color of the plotted surface.
I do not want a multi-color plot.
I want a single rgb color for the surface.
What values do I have tp put into 'colr' matrix of surfc(x,y,z,colr) to get a single colored surface.
Do I also need to use a colormap statement like 'colormap hsv;' or 'colormap bone' if I want a single rgb colored surface.
How to control the colors of the countour lines?
Thanks
Tricia
0
Reply Tricia 12/11/2010 9:00:20 PM

On 11/12/10 3:00 PM, Tricia wrote:

> I am using surfc(x,y,z,colr) to plot a 3D surface with good success.
> I am having problems controlling the color of the plotted surface.
> I do not want a multi-color plot.
> I want a single rgb color for the surface.
> What values do I have tp put into 'colr' matrix of surfc(x,y,z,colr) to
> get a single colored surface.

colr = 1;

would probably get you the surface colored by the last color in the 
colormap.

If you want to specify the exact index of the colormap, do so in colr 
and pass 'CDataMapping', 'direct' as the last arguments to surfc()

> Do I also need to use a colormap statement like 'colormap hsv;' or
> 'colormap bone' if I want a single rgb colored surface.

Only if you want to control the color you get.

colormap([R G B])

for some particular R G B values (0 to 1 range) would work in 
combination with colr = 1 and leaving CDataMapping as the default.

> How to control the colors of the countour lines?

save the output of surfc() to a variable. The first entry of that array 
will be the handle to the surface itself. All remaining entries in the 
array will be the handle to a patch() object that draws one distinct 
contour line (not contour level!). Those patches will all have their 
zdata deliberately set to the lower value of the zlim so that the 
contour lines appear "below" the surface; because of this, you cannot 
simply read the zdata out of each patch to determine the z level it 
corresponds to. The good news is that in each patch, the 'Userdata' 
field has been set to the contour level. You would set() the 'EdgeColor' 
property of the patch to reflect the color you want to appear for that 
level.
0
Reply Walter 12/12/2010 3:59:01 AM


Walter Roberson <roberson@hushmail.com> wrote in message <9MXMo.4257$Zf2.2868@newsfe17.iad>...
> On 11/12/10 3:00 PM, Tricia wrote:
> 
> > I am using surfc(x,y,z,colr) to plot a 3D surface with good success.
> > I am having problems controlling the color of the plotted surface.
> > I do not want a multi-color plot.
> > I want a single rgb color for the surface.
> > What values do I have tp put into 'colr' matrix of surfc(x,y,z,colr) to
> > get a single colored surface.
> 
> colr = 1;
> 
> would probably get you the surface colored by the last color in the 
> colormap.
> 
> If you want to specify the exact index of the colormap, do so in colr 
> and pass 'CDataMapping', 'direct' as the last arguments to surfc()
> 
> > Do I also need to use a colormap statement like 'colormap hsv;' or
> > 'colormap bone' if I want a single rgb colored surface.
> 
> Only if you want to control the color you get.
> 
> colormap([R G B])
> 
> for some particular R G B values (0 to 1 range) would work in 
> combination with colr = 1 and leaving CDataMapping as the default.
> 
> > How to control the colors of the countour lines?
> 
> save the output of surfc() to a variable. The first entry of that array 
> will be the handle to the surface itself. All remaining entries in the 
> array will be the handle to a patch() object that draws one distinct 
> contour line (not contour level!). Those patches will all have their 
> zdata deliberately set to the lower value of the zlim so that the 
> contour lines appear "below" the surface; because of this, you cannot 
> simply read the zdata out of each patch to determine the z level it 
> corresponds to. The good news is that in each patch, the 'Userdata' 
> field has been set to the contour level. You would set() the 'EdgeColor' 
> property of the patch to reflect the color you want to appear for that 
> level.

Walter,
Thank you very much.
Using your suggested methods I have been able to obtain full color control of the surface and contour lines.
Thanks again
Tricia
0
Reply Tricia 12/12/2010 2:50:21 PM

2 Replies
363 Views

(page loaded in 0.069 seconds)

Similiar Articles:













7/24/2012 10:56:03 PM


Reply: