我正在使用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)