Histogram of 2 sets of data in the same plot without the first becoming transparent

5 ビュー (過去 30 日間)
Summer
Summer 2015 年 12 月 12 日
回答済み: Walter Roberson 2015 年 12 月 12 日
Hi,
The following code is supposed to generate a plot of two overlapping histograms. However, for some reason the line in the first histogram becomes transparent (goes to the back). I would like for both lines to be clearly shown for comparison purposes.
figure;
it=1; # first histogram
Iterations(it)
X=[measurements,fliplr(measurements)];
y1=meanSolution(:,it)-stdevSolution(:,it);
y2=meanSolution(:,it)+stdevSolution(:,it);
Y=[y2',fliplr(y1)'];
h=fill(X,Y,'b');
set(h,'Facecolor',[1 0.84 0.99]);
set(h,'FaceAlpha',0.5);
set(h,'LineStyle','none');
hold on
h=plot(Measurements,meanSolution(:,it)); # This one becomes transparent for some reason (sent to the back)
set(h,'Color',[1 0.84 0.99]);
set(h,'LineWidth',2);
it=10; # Second histogram
Iterations(it)
X=[Measurements,fliplr(Measurements)];
y1=meanSolution(:,it)-stdevSolution(:,it);
y2=meanSolution(:,it)+stdevSolution(:,it);
Y=[y2',fliplr(y1)'];
h2=fill(X,Y,'b');
set(h2,'Facecolor',[0.5 0.34 0.99]);
set(h2,'FaceAlpha',0.5);
set(h2,'LineStyle','none');
h2=plot(Measurements,meanSolution(:,it));
set(h2,'Color',[0.5 0.34 0.99]);
set(h2,'LineWidth',2);
Any help would be greatly appreciated.

回答 (2 件)

Summer
Summer 2015 年 12 月 12 日
編集済み: Summer 2015 年 12 月 12 日
I want somethings similar to this attached figure. In my case, the pink line is transparent (sent to the back).
Thanks.

Walter Roberson
Walter Roberson 2015 年 12 月 12 日
If you are using R2014b or later, you may need to change your SortMethod; see this blog

カテゴリ

Help Center および File ExchangeData Distribution Plots についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by