我正在运行Octave 3.4.0,并且想创建一个透明的曲面图。然而,在使用facealpha、edgealpha、alphadata和alphadatamapping时,我无法做到这一点。
用于创建非透明曲面的示例代码:
p = peaks(40);
f1 = figure(10);clf
s1 = surface(p)
view(3)
xlabel('x');ylabel('y');
hold on;plot3([0 40],[40 0],[-10 10],'k')
set(s1,'edgecolor','none')
set(s1,'facealpha',0.2)结果如下图所示。正如您所看到的,在开始时以对角线绘制的线隐藏在曲面后面,即使曲面被认为是半透明的。这是我的Octave版本中的一个bug,还是我遗漏了什么?

发布于 2012-08-22 22:13:05
我在Octave 3.6.2上使用gnuplot作为图形工具包。所以你最好升级你的Octave安装。
不过,有两件事需要注意:
发布于 2014-06-12 05:53:57
我同意维达尔的观点:他的代码不支持最新的Octave3.8.1 (Cygwin 1.7.30(0.272/5/3) setup_x86_64.exe:2.850 xTerm305-1 Gnuplot4.6.3-3)。facealpha只做较浅颜色的冲浪。但是,一种解决方法是,octave中的mesh命令具有丢弃faces的功能:hidden (manual)。
所以
p = peaks(40);
f1 = figure(10);clf
s1 = mesh(p)
view(3)
xlabel('x');ylabel('y');
hold on;plot3([0 40],[40 0],[-10 10],'k')
hidden('off')产生

发布于 2019-08-29 04:50:51
这实际上在Octave 5.1.0中对我是有效的,但是命令的顺序很重要。在绘制线条之前,您需要设置alpha。试着只使用它自己的表面,并使用alpha -它是有效的:
>> s1 = surface(p)
s1 = -2.7876
>> view(3)
>> set(s1,'facealpha',0.5)
>> colormap jet
>> grid on; % so you can see the grid through the transparent surface:https://stackoverflow.com/questions/12072412
复制相似问题