plotly_matlab icon indicating copy to clipboard operation
plotly_matlab copied to clipboard

Add opacity on Matlab patch elements

Open graille opened this issue 3 years ago • 0 comments

NOTE: I reopened the pull request after a fail in branch selection. Old one can be deleted

Currently, patch elements don't have any opacity. So, when using a patch with an alpha layer, it just appears as a plain color. To fix this, I added a management of the alpha layer using rgba instead of rgb when it is available.

Example with a simple code using obw function (built-in function which add a patch on the frequency area containing 99% of signal energy).

close all;
figure;
nSamp = 1024;
Fs = 1024e3;
SNR = 40;
rng default

t = (0:nSamp-1)'/Fs;

x = chirp(t,50e3,nSamp/Fs,100e3);
x = x+randn(size(x))*std(x)/db2mag(SNR);
obw(x, Fs);
title('test');
grid on;

p = fig2plotly;

Before : before

After : After

graille avatar Dec 23 '21 02:12 graille