How to solve surface plot viewing issue?

3 views (last 30 days)
Subhodh Sharma
Subhodh Sharma on 27 Sep 2021
Answered: Star Strider on 27 Sep 2021
I have plotted a data of dimension 20*86 using the surface command. You can see the highlighted zone where the x=4 and Y=10. But without this highlighted zone it feels like the region is x=~20 and y=5.
Is there any way to show exactly this plot from its exact location ? (because without highlight it feels it's over x=~20 and y=5).
I would really appreciate your help.

Answers (1)

Star Strider
Star Strider on 27 Sep 2021
Using an axes call could make the axis limits a bit more obvious, and to call attention to a specific point, one option is to draw a straight vertical line to it —
[X,Y,Z] = peaks(20);
F = scatteredInterpolant(X(:),Y(:),Z(:));
Zsel = F(-1, 2)
Zsel = 2.1753
figure
surf(X,Y,Z, 'FaceAlpha',0.5)
hold on
plot3([1 1]*(-1), [1 1]*2, [min(zlim) Zsel], '-k', 'LineWidth',2)
hold off
grid on
axis('tight')
xlabel('x')
ylabel('y')
view(-120,30)
Adding a text object is also an option.
Experiment to get different results.
.

Products


Release

R2016b

Community Treasure Hunt

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

Start Hunting!