Skip to Main Content Skip to Search
Login
File Exchange
MATLAB Newsgroup
Link Exchange
  Blogs  
 Contest 
MathWorks.com

Thread Subject: surfc help

Subject: surfc help

From: John L

Date: 03 Aug, 2007 21:10:20

Message: 1 of 5

Is there any way to take the plane that the contours are
projected on and move it above the rendered surface...this
seems like a logical thing, but I could not find an option
or what not to that effect.

Thanks for the help,
John

Subject: Re: surfc help

From: us

Date: 03 Aug, 2007 21:26:39

Message: 2 of 5

John L:
<SNIP wants to move his/her contours along the z-axis...

one of the solutions

% the plot
sh=surfc(peaks(32));
% the engine
sh=findall(sh,'type','patch');
zi=get(gca,'zlim');
for i=1:numel(sh)
zd=get(sh(i),'zdata');
zd=zi(2)*ones(size(zd))+5;
set(sh(i),'zdata',zd);
set(sh(i),'linewidth',2);
end

us

Subject: Re: surfc help

From: us

Date: 03 Aug, 2007 21:33:13

Message: 3 of 5

John L:
<SNIP wants to move his/her contours along the z-axis...

one of the solutions

% the plot
     sh=surfc(peaks(32));
% the engine
     sh=findall(sh,'type','patch');
     zi=get(gca,'zlim');
for i=1:numel(sh)
     zd=get(sh(i),'zdata');
     zd=zi(2)*ones(size(zd))+5;
     set(sh(i),'zdata',zd);
     set(sh(i),'linewidth',2);
end

us

Subject: Re: surfc help

From: Shaun

Date: 04 Aug, 2007 03:29:58

Message: 4 of 5

Another way

sh = surfc(peaks(32));
zLevel = 15;
ph = findobj(sh,'Type','patch');
zlim = get(gca,'ZLim');
pv = get(ph,'zdata');
pv = cellfun(@(x)zLevel+x-zlim(1),pv,...
    'UniformOutput',false);
pn = {'zdata'};
set(ph,pn,pv,'LineWidth',2)

Subject: Re: surfc help

From: Shaun

Date: 04 Aug, 2007 16:25:49

Message: 5 of 5

A little better

sh = surfc(peaks(32));
zLevel = 15;
ph = findobj(sh,'Type','patch');
pv = get(ph,'zdata');
pv = cellfun(@(x)zLevel+x*0,pv,...
    'UniformOutput',false);
pn = {'zdata'};
set(ph,pn,pv,'LineWidth',2)

Shaun

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
code us 03 Aug, 2007 17:30:34
findall us 03 Aug, 2007 17:30:34
zdata us 03 Aug, 2007 17:30:34
surfc John L 03 Aug, 2007 17:10:21
rssFeed for this Thread

envelope graphic E-mail this page to a colleague

Public Submission Policy
NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Disclaimer prior to use.
Related Topics