我正在尝试呈现两个直方图,并且我希望它们中的每一个都具有不同的颜色。让我们说一红一蓝。到目前为止,我设法改变了它们的颜色,但只改变了相同的颜色。
这是代码
close all
b=-10:1:10;
x=randn(10^5,1);
x=(x+5)*3;
y=randn(1,10^5);
y=(y+2)*3;
hist(x,100)
hold on
hist(y,100);
h = findobj(gca,'Type','patch');
set(h,'FaceColor','r','EdgeColor','w')
%the last two lines changes the color of both hists.