【发布时间】:2020-07-15 22:06:21
【问题描述】:
我知道这是次要的,但这是为了出版,会让我发疯。 P0688 盒子的底部比其他的要薄 1-2 个像素。我不想让边框变粗,因为它与条形图的其余部分不匹配。
plot<- ggplot(tukey_letters, aes(x = variable, y = value.x,
fill = L1)) +
theme(panel.background=element_rect(fill="#ffffff", color
="#000000"), panel.grid.major=element_blank(),
panel.grid.minor=element_blank()) +
geom_bar(stat = "identity", position=position_dodge(),color="black")+ scale_fill_manual(values=c("#FFFFFF", "#999999"))+ guides(fill=guide_legend(title="Genotype", title.position = "left")) +
geom_errorbar(aes(ymin=value.x-se, ymax=value.x+se), width=.1,size=.5,position=position_dodge(0.9), color="black")+
theme(
axis.title = element_text(size =12, face="bold"),
axis.text = element_text(angle=30, vjust=0.5,hjust=0.6,size=8,face="bold", color="#000000"),
axis.ticks = element_line(size = rel(1)),
axis.ticks.length = unit(0.3, "cm"),
legend.position = c(0.2, 0.9)
)+
labs(
x="Treatment",
y="ARI1"
)+
#facet_wrap(~L1)+ ## You can use face_wrap function only if you need it+
geom_text(data =tukey_letters,
aes(x=xpos, y=ymax+offset_asterisk,label=groups),
size = 4,position=position_dodge(0.9) , vjust=-0.5
)
提前致谢。让我知道是否还有其他需要帮助解决此问题。
【问题讨论】:
-
You may want to check out this question。寻找 u/Tung 的答案(目前位于顶部)。看起来对于垂直定位的填充图例(就像你有的那样),仍然存在间距差异小的问题(它也让我感到烦恼 - 完全明白)。有关更多信息,请参阅this issue。
-
是的,我看到了。也许我执行不正确,因为 legend.spacing.y 没有改变白色和灰色框之间的距离。
-
是的 - 在我找到帖子和填充垂直图例有点错误的特定情况之前,我摆弄了 10 分钟。 :/ 你能切换到水平吗? :)
标签: r ggplot2 formatting legend