如何在小平面网格线之间放置分区 [英] How to place divisions between facet grid lines

查看:80
本文介绍了如何在小平面网格线之间放置分区的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用ggplot和 facet_grid 来制作发布图。我不确定审稿人如何对标准的灰色背景做出反应,使用白色网格线,所以我正在准备和不准备。但是,当我使用 opts(panel.background = theme_blank())时,显示器缺少标准背景给出的窗格区分。

代码

  ggplot(CO2,aes(conc))+ geom_density()+ 
facet_grid(Type〜Treatment)+
opts(panel.background = theme_blank())

当前结果



预期结果



解决方案

  last_plot()+ theme_bw()




$ b $ $ $ $ $ $ $ last_plot()+ $
opts(panel.background = theme_rect(fill = NA,color =black))

从版本0.9.2开始, opts 已被主题取代

  last_plot()+ 
主题(panel.background = element_rect(fill = NA,color =black))


I'm using ggplot with facet_grid to make a plot for publication. I'm not sure how the reviewers will react to the standard gray background with white grid lines and so I'm preparing with and without. However when I use opts(panel.background = theme_blank()) the display lacks the between panes discrimination that the standard background gives. what is the easiest way to add the between pane grid back (not that it was there but it was white against gray) that looks similar to my desired outcome below?

The Code

ggplot(CO2, aes(conc)) + geom_density() + 
    facet_grid(Type~Treatment) +
    opts(panel.background = theme_blank())

Current Outcome

Desired Outcome

Thank you in advance.

解决方案

This should do:

last_plot() + theme_bw()

or

last_plot() + 
   opts(panel.background = theme_rect(fill = NA, color = "black"))

Since version 0.9.2, opts has been replaced by theme:

last_plot() + 
   theme(panel.background = element_rect(fill = NA, color = "black"))

这篇关于如何在小平面网格线之间放置分区的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆