matlab中gscatter函数多种颜色如何?

理由
举报 取消

在使用MATLAB中遇到一些问题,求教各位在使用MATLAB中的gscatter函数作图的时候,需要对点进行着色。如果用matlab系统提供的关键字的话 只有y,m,c,r,g,b,w,k八种颜色,如果我想使用超过10中颜色进行着色,那么应该如何使用gscatter函数呢?附上我的着色语句:gscatter(output_xi, output_yi, train_labels10 ,’ymcrgbwk’, ‘.’);output_xi output_yi 分别是x,y坐标train_labels10是分成的是个聚类的标号,现在想给将所有的点按照聚类的标号标为10中颜色,请问应该如何操作呢?谢谢各位!

2018年1月15日 3 条回复 2344 次浏览

发起人:杨奕宁 初入职场

Making mistakes that result in bugs, tearing your hair out in frustration, the light bulb moment when you realize what’s wrong, the satisfaction of fixing the bug

回复 ( 3 )

  1. 姜宇
    理由
    举报 取消

    根据gscatter的帮助文档 ”gscatter(x,y,group,clr,sym,siz) specifies the color, marker type, and size for each group.clr is either a string array of colors recognized by the plot function or a three-column matrix of color specifications.“

    也就是说color可以用plot所默认的那些字符表示或者直接用三列R,G,B数值来表示。后者可以有足够多种组合。(参见 Color specification

  2. 匿名用户
    理由
    举报 取消

    看gscatter的帮助:

    clr is either a string array of colors recognized by the plot function or a three-column matrix of color specifications.

    你是不是只看了前半句?

  3. 用户头像
    理由
    举报 取消

    你好,这个问题解决了吗?gscatter(data(:,1),data(:,2),labels,’rgb[0.2 0.5 0.6]’,’*++++’);这样写不行啊,求指教

我来回答

Captcha 点击图片更换验证码