相关疑难解决方法(0)

在ggplot中的geom_point(scale_colour_manual)中填充和边框颜色

我正在使用ggplot进行散点图.我想有个与特定的颜色和填充(中plot,colour="blue", fill="cyan4"有前),但我怎么也找不到.我对此有何看法:

ggplot(df, aes(own,method)) +
  panel.configuration +
  scale_shape_identity() +  #to use the 'plot' shape format.
  geom_point(aes(color = factor(label)), position = "jitter",size=3) +  
Run Code Online (Sandbox Code Playgroud)

(在之前geom_point我尝试过shape=21按照我的方式添加plot)

  scale_colour_manual(values=c("A"="chocolate3","B"="cyan4")) +
  scale_fill_manual(values=c("A"="green", "B"="red")) + #DOES NOTHING...
  xlim(7,47) + ylim(7,47)+ ... etc.
Run Code Online (Sandbox Code Playgroud)

这就是我没有"shape = 21"的结果

在此输入图像描述

这是我添加"shape = 21"时得到的结果.在这两种情况下它都会忽略scale_fill 在此输入图像描述

我也尝试添加fill=c("blue","red")geom_point,但R抱怨:"错误:设置美学的不兼容长度:形状,大小,填充".

有关如何获得它的任何建议?什么是错scale_fill在我的代码?

非常感谢你!

数据(df)看起来像:

21 15 A
24 16 A
24 17 A
28 14 A
24 15 A
22 15 A
20 18 …
Run Code Online (Sandbox Code Playgroud)

r colors ggplot2

32
推荐指数
1
解决办法
8万
查看次数

标签 统计

colors ×1

ggplot2 ×1

r ×1