在Octave曲面图的顶部绘制3D线 [英] Plot 3D line on top of surface plot in Octave
本文介绍了在Octave曲面图的顶部绘制3D线的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我已经根据一些数据绘制了一个表面.在同一个绘图中,我想要一条3D线(我想要绘制的线具有[x,y,z]值).当我尝试使用同一图中的plot3(x,y,z)进行此操作时,该线始终位于曲面下方.
I have plotted a surface from some data. In the same plot I want to have a 3D line (I have the [x,y,z] values for the line I want to plot). When I try to do this using plot3(x,y,z) in the same figure, the line is always below the surface.
有什么办法可以解决这个问题?我不知道这个问题是否也出现在Matlab中.
Is there any way to fix this? I don't know if this problem appears in Matlab as well.
最小示例:
figure;
hold all;
y = x = 0:35;
z = ones(1,36).*0.5;
plot3(x,y,z);
[X,Y] = meshgrid(-8:.5:8);
R = sqrt(X.^2 + Y.^2) + eps;
Z = sin(R)./R;
surf(Z);
结果(蓝线在表面下方)
The result (the blue line is below the surface):
推荐答案
要回答部分问题,您不会在MATLAB中使用以下代码遇到此问题:
To answer part of your question, you don't get this problem in MATLAB with the following code:
figure;
hold all;
x = 0:35;
y = x;
z = ones(1,36).*0.5;
plot3(x,y,z);
[X,Y] = meshgrid(-8:.5:8);
R = sqrt(X.^2 + Y.^2) + eps;
Z = sin(R)./R;
surf(Z);
这篇关于在Octave曲面图的顶部绘制3D线的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文