相关疑难解决方法(0)

`fill`比例未显示在图例中

这是我的虚拟代码:

set.seed(1)
df <- data.frame(xx=sample(10,6), 
                 yy=sample(10,6), 
                 type2=c('a','b','a','a','b','b'),
                 type3=c('A','C','B','A','B','C')
                 )
ggplot(data=df, mapping = aes(x=xx, y=yy)) + 
geom_point(aes(shape=type3, fill=type2), size=5) +
  scale_shape_manual(values=c(24,25,21)) +
  scale_fill_manual(values=c('green', 'red'))
Run Code Online (Sandbox Code Playgroud)

结果图有一个图例,但它的'type2'部分并不反映fill价值尺度- 它是否符合设计?

样本图

r ggplot2

9
推荐指数
2
解决办法
2910
查看次数

在ggplot中更改颜色填充和点的形状

我想在ggplot中更改点的形状和颜色填充,这是我的代码部分工作,颜色图例仍然是黑色.

ID<-rep(c("KO", "WT"), each=4)
O<-rep(c("HP", "NN"), each=2, times=2)
Methionine<-rep(c("- Methionine", "+ Methionine"), each=2, times=2)
mean.1<-sample(50:100, 8)
se.1<-runif(8, min=1, max=3)
mydata<-data.frame(ID, O, Methionine, mean.1, se.1)

ggplot(mydata, aes(x=O, y=mean.1, ymax=max(mean.1), shape=Methionine, fill=ID)) + 
  geom_errorbar(aes(ymin=mean.1-se.1, ymax=mean.1+se.1), size=1,colour="black", width=.15) +
  geom_point( size = 10) +
  scale_shape_manual(labels=c("+ Methionine", "- Methionine"),
                     values = c(21,22))+
  scale_fill_manual(name=bquote(bold(paste(alpha, " "))), values = cols)
Run Code Online (Sandbox Code Playgroud)

r ggplot2

3
推荐指数
1
解决办法
3137
查看次数

标签 统计

ggplot2 ×2

r ×2