[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Transparent lines

From: Markus Mützel
Subject: Re: Transparent lines
Date: Mon, 15 Mar 2021 17:02:19 +0100

Am 15. März 2021 um 15:30 Uhr schrieb "Felix Salazar":
> Hello community,
> I was wondering if there would be any way to plot lines with tranasèarency, 
> or to set an alpha channel in the color spec for a plot. Or at least plans to 
> implement it in the future.
> a MWE
> figure()
> t=linspace(0,2*pi,10000);
> hold on
> p1=plot(t,sin(t)+0.25*randn(size(t)));
> p2=plot(t,sin(t+pi/2)+0.25*randn(size(t)));
> p3=plot(t,sin(t-pi/2)+0.25*randn(size(t)));
> p4=plot(t,sin(t+pi)+0.25*randn(size(t)));
> hold off
> I would like to have the plot lines with some sort of translucency. In 
> Matlab, I can then put
> p1.Color(4)=0.05
> to set the alpha channel to 5%
> I just want to plot high frequency signals, and present the noise as a shadow 
> of the filtered signal.
I wasn't aware that it was possible to pass the alpha channel as part of the 
color property. It seems to be undocumented afaics:

But I can see where that feature can be useful. Thanks for pointing this out.

Getting transparency right is tricky. In particular, there is currently no code 
in Octave that could do the necessary back-to-front sorting to render 3d scenes 
with transparency correctly.
Nonetheless, having transparent lines in a 2d scene that is similar to the one 
you showed is probably possible without complicated back-to-front sorting -- if 
the user could print the transparent lines from the background before printing 
any solid lines in the foreground.

Currently, Octave doesn't accept RGBA quadruplets as values for the "color" 
property of lines.  Nor does it have other means to plot lines with 

Since this would be a new feature, it won't be added before the next major 

In the meantime: If you *really* need transparent lines, you could save the 
figure as a .svg file and add `stroke-opacity="0.05"` to the `<polyline>`s 
you'd like to be transparent.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]