Why do I receive an error when I try to change the transparency property of my barseries object in MATLAB 7.0 (R14)?

22 views (last 30 days)
I execute the following code in MATLAB 7.0 (R14):
v1 = rand(81,1);
c1 = [1 0 1];
H1=histfit(v1);
set(H1(2),'Color',c1);
set(H1(1),'FaceColor',c1);
set(H1(1),'FaceAlpha',0.5);
I receive the following error message:
"??? There is no 'FaceAlpha' property in the 'barseries' class."
The above code executed without errors in previous versions of MATLAB.

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 27 Jun 2009
In MATLAB 7.0 (R14) and higher versions, the barseries object is of type 'hggroup' instead of type 'patch' as in earlier versions. The 'FaceAlpha' property that you would like to change is a property of a patch object which is now a child of the barseries object of type 'hggroup'.
You will need to modify your code to change the transparency property of a barseries object as follows:
v1 = rand(81,1);
c1 = [1 0 1];
H1=histfit(v1);
set(H1(2),'Color',c1);
set(H1(1),'FaceColor',c1);
hpatch = get(H1(1),'children');
set(hpatch,'FaceAlpha',0.1);

More Answers (0)

Categories

Find more on Graphics Object Programming in Help Center and File Exchange

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!