MATLAB 中如果用scatterplot 绘制的图,颜色怎么改

MATLAB 中如果用scatterplot 绘制的图,默认的是蓝色,想要用红色表示怎么写命令。加( ...,‘r’)不行啊

>>a = rand(10,1);

scatterplot(a,1,0,'rx');

追问

(a,1,0,'rx')中1,0是什么意思?

追答

scatterplot(x,n,offset,plotstring) is the same as the syntax above, except that plotstring determines the plotting symbol, line type, and color for the plot. plotstring is a string whose format and meaning are the same as in the plot function.

温馨提示:答案为网友推荐,仅供参考
第1个回答  推荐于2016-11-02
When C is a length(X)-by-3 matrix,t specifies the colors of the markers as RGB values,也就是后面决定颜色的RGB不能只是一列数组,要是length(X)-by-3 matrix。

scatter(msdata(i,1),msdata(i,2),'.',[0.1,0.3,0]); 可以改成
scatter(msdata(i,1),msdata(i,2),'.',ones(length(msdata(i,1)))*[0.1,0.3,0]);
相似回答