Octave surface transparency setting

I am running Octave 3.4.0 and want to create a transparent surface area. However, I could not do this when I was messing around with facealpha , edgealpha , alphadata and alphadatamapping .

Sample code for creating an opaque surface:

 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) 

The result is shown in the image below. As you can see, the line drawn diagnostically at the beginning is hidden behind the surface, although the surface is supposed to be translucent. Is this a bug in my version of Octave, or am I missing something?

enter image description here

+4
source share
3 answers

This works for me on Octave 3.6.2, using gnuplot as a graphical toolkit. Therefore, you are better off updating your Octave installation.

Two things to note:

  • the part of the diagonal line that goes behind the surface is not drawn in the lighter, so it still looks strange;
  • with the new fltk experimental graphical toolkit, it doesn't work at all.
+3
source

I agree with Vidar: its code does not work with the latest Octave 3.8.1 (Cygwin 1.7.30 (0.272 / 5/3) setup_x86_64.exe: 2.850 xterm 305-1 Gnuplot 4.6.3-3). facealpha just makes the surf brighter. However, one workaround is that the mesh command in the octave has the ability to discard faces: hidden ( manual ).

So

 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') 

produces

code output

+3
source

This actually worked for me in Octave 5.1.0, but the order of the commands is important. You need to set alpha BEFORE building the line. Try only the surface yourself and play with alpha - this works:

 >> 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: 

Surfing with transparency

+1
source

All Articles