如何将抖动的点保持在facet_grid的边界上

时间:2019-03-04 17:42:43

标签: r ggplot2

我正在尝试抖动在facet_grid中绘制的某些点(列是基因名称),但是这些点一直在抖动,以使其与构面网格的边界重叠。有避免这种情况的简便方法吗?

以下代码:

ggplot(Figure, aes(x = 0, y = Number, col = Status)) + 
  geom_point(size = 9, alpha = 0.6, position = position_jitter(w = 0.1)) + 
  facet_grid(. ~ Gene, scales =  NULL) +
  theme(axis.title.x=element_blank(), 
        axis.text.x=element_blank(), 
        axis.ticks.x=element_blank(), 
        plot.title = element_text(size = 22), 
        axis.title.y=element_text(size = 20, face="bold"), 
        axis.text.y =element_text(size=18, face="bold",)) +
  scale_color_manual(values = c("Red" = "firebrick3", 
                                "Gold" = "gold", 
                                "Green" = "forestgreen")) + 
  theme(strip.text.x = element_text(size = 18, face="bold.italic")) + 
  theme(legend.text=element_text(size=14, face = "bold")) +  
  theme(legend.title = element_blank())

抖动到刻面边界上的点:

Points jittered onto border of facet_grid

0 个答案:

没有答案