用“for”循环和“如果”然后是不同颜色的散点图
我想要一个针对不同字段具有两种不同颜色的散点图。
我有一张表,其中包含 x1
、x2
、y3
。我使用 scatter(x1,x2,"o","filled") 进行了一次散布,但我希望颜色以 y3 为基础。
y3 的值从 0 到 81。我希望值 <10 的字段为绿色,反之亦然,值>10 的字段为红色。
I would like a scatter plot with two different colors for different fields.
I have one table with x1
, x2
, y3
. I make one scatter with scatter(x1,x2,"o","filled")
, but I would like that colors were on the base of y3
.
y3
has values from 0 to 81. I would like that fields with values<10 were green, vice versa values>10 were red.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以使用可选的第四个输入
scatter
指定颜色。这意味着您还需要定义第三个输入,它指定标记大小:You can use the optional fourth input of
scatter
to specify color. That means you also need to define the third input, which specifies marker size: