sile123 发表于 2006-5-29 17:26

[求助]关于hist

先看下列程序
x=binornd(10,0.5,100,1); %生成二项分布随机数
y=binornd(10,0.5,100,1); %同上
z=x*y'; %将x与y向量相乘赋给z
hist(z,50);axis();
我起先令z=x+y或x-y,画的图都是蓝色条状图(下图后者),而令z=x*y'或x/y,画的图都是各种颜色的(如下图前者)。我知道前两者生成都是向量,后两者生成都是矩阵,但我不知道为什么画出的是彩色图,各自的颜色是什么意思,为什么向量和矩阵的图颜色不一样呢?本人毕业论文就快写完了,可这个问题还没解决,达人帮忙说明下啊,小弟在这里先谢谢了!

happy 发表于 2006-5-29 20:29

回复:(sile123)[求助]关于hist

The histogram is created with a patch graphics object. If you want to change the color of the graph, you can set patch properties. See the "Example" section for more information. By default, the graph color is controlled by the current colormap, which maps the bin color to the first color in the colormap.

具体你可以看看colormap的帮助

sile123 发表于 2006-5-30 10:55

谢谢教授,我回去看一下!
页: [1]
查看完整版本: [求助]关于hist