MATLAB: How to set FaceAlpha of area plot

areafacealphatransparency

Hi, I run in some issues when I try to set the transparency of an area plot. I can set the transparency of the histogram but not of the area plot. Is this a bug? Version: R2015a 8.5.0.197613.
This is the code I used:
clc;clear;
figure
h = histogram(1:10);
h.FaceAlpha = 0.2;
grid
figure
a = area(1:10);
grid
a.FaceAlpha = 0.2;
This is the warning I get: "No public field FaceAlpha exists for class matlab.graphics.chart.primitive.Area."
Thanks

Best Answer

Your code works correctly for me in R2016a.
As an alternative, you can use the patch function:
figure(2)
a = patch([1:10 10:-1:1], [1:10 zeros(1,10)], 'b');
grid
a.FaceAlpha = 0.2;
Note that you have to change your code to define the patch object, here adding a zeros vector to complete it.