Moving the contour plot with the surfc plot function

Moving the contour plot with the surfc plot function

Post by Matthew Gi » Fri, 20 Apr 2007 07:03:19

My name is Matthew Gibb, I am a fourth year physics undergraduate and
my dissertation is due to be handed in at the end of next week. I
need to plot a surfc graph but with the contour graph on top of the
surface plot i.e. at z > all values on surface, instead of
underneath it on the z = 0 plane where it is obscured in my plot. In
the help file for meshc it says to plot a mesh graph using mesh not
meshc, then put hold on and plot a contour graph afterwards for more
control as to at what z plane it is plotted at, but neither this nor
the contour help file goes into further detail. I have searched the
online help forums but to no avail. If anyone thinks they can help
but don't know quite what i mean, i have a lovely example of what i
want from a carbon nanotubes paper i recently read that i can send
you, but unfortunately it won't let me copy bitmaps into this text
I have tried everything I can think of and don know what else to
do. Please help if you can!

Many thanks,

Matt Gibb.

Moving the contour plot with the surfc plot function

Post by Ken Garrar » Fri, 20 Apr 2007 08:24:11

else to


You can create the contours with contour3, then set the ZData
property for each patch object to a constant that puts the contour
plot where you want it.

Here is an expedient solution to your problem.

1) open the surfc function in the mfile editor
2) immediately save-as to a new file in your workspace, say
3) find the line commented "Always put contour below plot." (line 59
for release 2007a)
4) change "zpos = a(1);" to "zpos = a(2);"
5) save the new mfile
6) plot your data with surfctop(...)

Step 4 sets the location of the contours to the upper z limit of the
axes created by the surface plot.

Hope this helps,