我正在尝试使用我在此论坛和其他地方找到的命令覆盖我的符号大小aes。我可以让alpha覆盖工作,但不是大小。
f1<-ggplot(data=d, aes(x=rpos, y=count, group=id,color=id)) +
geom_point(alpha=0.05, size=0.5) +
scale_fill_manual(values=c("blue", "red")) +
scale_colour_manual(values=c("blue", "red")) +
xlab("Chromosome 1") +
scale_y_continuous(name="Relative coverage",limits=c(-0.5,1.5)) +
guides(colour =guide_legend(override.aes=list(size=5))) +
guides(colour = guide_legend(override.aes = list(alpha = 1))) +
theme_bw()
optns <- theme (
plot.title = element_text(face="bold", size=14),
axis.title.x = element_text(size=12),
axis.title.y = element_text(size=12, angle=90),
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = c(.97,.85),
legend.text = element_text(size=10),
legend.key.size = unit(1, "lines"),
legend.key = element_blank(),
legend.justification = 'right'
)
f1 + ggtitle ("Coverage of Chromosome 1") +
optns + ggsave("Rel.mergedDataChr1.pdf", width = 20, height = 5, dpi = 100)
答案 0 :(得分:2)
您的Alpha覆盖会覆盖您的尺寸覆盖。改变这个:
guides(colour = guide_legend(override.aes = list(size=5))) +
guides(colour = guide_legend(override.aes = list(alpha = 1))) +
到此:
guides(colour = guide_legend(override.aes = list(size=5, alpha = 1))) +
将来,请尝试添加最少工作示例。这意味着既提供数据(使其成为一个工作示例),也不打扰所有optns
之类的事情(保持最小化)。