How to add 3D points to a surfc surface plot?

190 views (last 30 days)
Hi MATLAB Central,
I have a 2D matrix called "HS" with columns (X) and rows (Y). Using the command below I can produce a beautiful 3D surface plot:
figure;
surfc(X, Y, HS);
shading interp
However, what I really want to do is to add points to the surface plot. So I want to do something like:
figure;
hold on;
surfc(X, Y, HS);
shading interp
plot3(x,y,z, 'ko');
hold off;
When I do this the 3D surface plot breaks down. Even in the absence of the plot3 command, just adding the hold on;/hold off; causes the surface plot to break down into a 2D heatmap.
Surely, there must be a way to co-plot points onto a 3D surface plot? Does anyone know how?
Thanks in advance,
Anders

Accepted Answer

Walter Roberson
Walter Roberson on 22 Jan 2013
More the "hold on" until after the "surfc".

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!