分面和单个地块之间的ggplot差异

时间:2017-09-06 22:03:11

标签: r ggplot2

我认为分面图和单个图之间存在差异。

注意这些图中的鼠标编号9214:

# Make the faceted graph
fig1 = ggplot(raw, aes(raw$Bregma.)) + geom_density() + ggtitle("Fig. 1. Bregma Representation, by mouse (red = post-ex, green = post-rev)") + 
  geom_density(data = raw_excluded, aes(raw_excluded$Bregma.), color = "red") +
  geom_density(data = raw_revised, aes(raw_revised$Bregma.), color = "green")+ facet_wrap(~Mouse.ID.) 

FIG1

Faceted plot

当我为该数据运行单独的ggplot时,它看起来像这样,这不是分面图像中的样子:

temp_indiv_plot = function(x) {
  temp_mouse = x
  temp_mouse_original = filter(raw, raw$Mouse.ID == temp_mouse)
  temp_mouse_revised = filter(raw_revised, raw_revised$Mouse.ID. == temp_mouse)

  ggplot(temp_mouse_original, aes(x = temp_mouse_original$Bregma.)) + geom_density() + 
    geom_density(data = temp_mouse_revised, aes(temp_mouse_revised$Bregma.), color = "green") + 
    ggtitle(temp_mouse)
}

temp_indiv_plot("8350")
temp_indiv_plot("9214")

Individual plot for mouse 9214

但是我绘制了另一只鼠标(8350)以查看它是否一致,但它看起来与刻面图相同(在我有足够的声誉之前,不能添加3个以上的链接,你必须要现在就接受我的话。)

为什么鼠标9214与众不同?

0 个答案:

没有答案