Why do I receive an error when I try to change the transparency property of my barseries object in MATLAB 7.0 (R14)?
51 views (last 30 days)
Show older comments
MathWorks Support Team
on 27 Jun 2009
Commented: Steven Lord
on 16 Dec 2018
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
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);
2 Comments
More Answers (1)
saurabh rathore
on 5 Jun 2018
Edited: Walter Roberson
on 5 Jun 2018
I am facing the same problem FaceAlpha is not working in histfit command
subplot(3,4,1)
histfit(sgacc,317)
h1 = histfit(sgacc,317);
set(h1(1),'facecolor',[.48,.66,.87])
set(h1(2),'color',[.23,.29,.56])
hold on
histfit(sgacc+4.97e+22,317)
ha = histfit(sgacc+4.97e+22,317);
set(ha(2),'color',[.23,.29,.56])
set(ha(1),'facecolor',[.85,.85,.95])
hpatch = get(ha(1),'children');
set(hpatch,'FaceAlpha',0.1)
set(hpatch,'EdgeAlpha',0.1)
there is no error but I am not able to make second histfit plot transparent. Please help.
1 Comment
saurabh rathore
on 5 Jun 2018
I am using Matlab2017b but I am unable to change barseries transparent using facealpha value
See Also
Categories
Find more on Random Number Generation 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!