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

16 次查看(过去 30 天)
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.

采纳的回答

MathWorks Support Team
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);

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Lighting, Transparency, and Shading 的更多信息

产品

Community Treasure Hunt

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

Start Hunting!

Translated by