matlab中 关于scatter plot 函数中颜色的问题“帮助”中说scatter的颜色只有若干种(没弄错的化是8种不同颜色可用)比如:scatter(msdata(i,1),msdata(i,2),'.','y');scatter(msdata(i,1),msdata(i,2),'.','g');scatter(msd
来源:学生作业帮助网 编辑:作业帮 时间:2024/06/20 12:18:53
![matlab中 关于scatter plot 函数中颜色的问题“帮助”中说scatter的颜色只有若干种(没弄错的化是8种不同颜色可用)比如:scatter(msdata(i,1),msdata(i,2),'.','y');scatter(msdata(i,1),msdata(i,2),'.','g');scatter(msd](/uploads/image/z/11501096-32-6.jpg?t=matlab%E4%B8%AD+%E5%85%B3%E4%BA%8Escatter+plot+%E5%87%BD%E6%95%B0%E4%B8%AD%E9%A2%9C%E8%89%B2%E7%9A%84%E9%97%AE%E9%A2%98%E2%80%9C%E5%B8%AE%E5%8A%A9%E2%80%9D%E4%B8%AD%E8%AF%B4scatter%E7%9A%84%E9%A2%9C%E8%89%B2%E5%8F%AA%E6%9C%89%E8%8B%A5%E5%B9%B2%E7%A7%8D%EF%BC%88%E6%B2%A1%E5%BC%84%E9%94%99%E7%9A%84%E5%8C%96%E6%98%AF8%E7%A7%8D%E4%B8%8D%E5%90%8C%E9%A2%9C%E8%89%B2%E5%8F%AF%E7%94%A8%EF%BC%89%E6%AF%94%E5%A6%82%EF%BC%9Ascatter%28msdata%28i%2C1%29%2Cmsdata%28i%2C2%29%2C%27.%27%2C%27y%27%29%3Bscatter%28msdata%28i%2C1%29%2Cmsdata%28i%2C2%29%2C%27.%27%2C%27g%27%29%3Bscatter%28msd)
matlab中 关于scatter plot 函数中颜色的问题“帮助”中说scatter的颜色只有若干种(没弄错的化是8种不同颜色可用)比如:scatter(msdata(i,1),msdata(i,2),'.','y');scatter(msdata(i,1),msdata(i,2),'.','g');scatter(msd
matlab中 关于scatter plot 函数中颜色的问题
“帮助”中说scatter的颜色只有若干种(没弄错的化是8种不同颜色可用)
比如:
scatter(msdata(i,1),msdata(i,2),'.','y');
scatter(msdata(i,1),msdata(i,2),'.','g');
scatter(msdata(i,1),msdata(i,2),'.','w');
……
……
如果要用比较多的颜色来表示画出的点,用上述8种颜色俨然不够了
请问,这里的'y’,'g’等能否用一个RGB值来表示呢,
我试过比如scatter(msdata(i,1),msdata(i,2),'.',[0.1,0.3,0]); 这样貌似不行啊,
还有其他方法吗
matlab中 关于scatter plot 函数中颜色的问题“帮助”中说scatter的颜色只有若干种(没弄错的化是8种不同颜色可用)比如:scatter(msdata(i,1),msdata(i,2),'.','y');scatter(msdata(i,1),msdata(i,2),'.','g');scatter(msd
scatter(X,Y,S,C) displays colored circles at the locations specified by the vectors X and Y (which must be the same size).
S determines the area of each marker (specified in points^2). S can be a vector the same length as X and Y or a scalar. If S is a scalar, MATLAB draws all the markers the same size. If S is empty, the default size is used.
C determines the color of each marker. When C is a vector the same length as X and Y, the values in C are linearly mapped to the colors in the current colormap. When C is a length(X)-by-3 matrix, it specifies the colors of the markers as RGB values. C can also be a color string (see ColorSpec for a list of color string specifiers).
上面的是help里面的话,里面说了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]);
自己揣摩下试试