stat_contour binwidth奇怪

时间:2013-05-31 18:32:35

标签: r ggplot2 contour levelplot

我有一些数据显示在刻面水平图(轮廓线)中,并且非常惊讶地看到其中一个面板中数据基本不变的奇怪的嘈杂轮廓线。我为整个图层(所有面板)设置了binwidth为1,并且该面板的数据子集在1 +/- 1e-10范围内,所以我希望在那里看不到轮廓线。经过多次子集化后,这里有一个显示轮廓线的数据示例,我不希望/期望看到一个。

b = data.frame(energy = rep(c(1,2),5), 
               R = rep(c(1-1e-10, 1), each=5), 
               N = c(55, 55, 65, 65, 75, 75, 85, 85, 95, 95))

ggplot(b)+ 
  geom_line(aes(energy, N, z=R), binwidth=1,
            alpha=0.5, stat="contour")

为什么ggplot2在这个数据恒定的区域显示轮廓线,给定binwidth >> range(b$R)

enter image description here

请注意,binwidth = 2会返回一个空白面板和一条警告消息

Warning message:
Not possible to generate contour data 

这是非常好的,也应该以更低的binwidth发生。

1 个答案:

答案 0 :(得分:0)

由于没有收到答案,我将此问题发布为bug report