ggplot():如何停止像这样的模拟之间的geom_path()绘制?

时间:2018-07-18 21:48:08

标签: r ggplot2

Plot showing jumps between simulations

enter image description here

我的geom_path()存在此问题。我想一起绘制许多模拟,但是出于某种原因,生成图时,ggplot会在不同的模拟之间绘制直线,而不是遵循正确的模拟。

colnames(HIV.prev.HF.Rand.95) <- outMatRand[[1]]$time
HIV.prev.HF.Rand.95_m <- melt(HIV.prev.HF.Rand.95)

colnames(HIV.prev.HF.Rand.sat) <- outMatRand[[1]]$time
HIV.prev.HF.Rand.sat_m <- melt(HIV.prev.HF.Rand.sat)

融化的数据看起来像这样:

     Var1 Var2       value
        .    .           .
        .    .           .
197    97 1986 0.001215456
198    98 1986 0.001277602
199    99 1986 0.001200965
200   100 1986 0.001247436
201     1 1987 0.001173847
202     2 1987 0.001301196
203     3 1987 0.001312864
204     4 1987 0.001544837
205     5 1987 0.001467538
206     6 1987 0.001509051
207     7 1987 0.001297585
208     8 1987 0.001538991
        .    .           .
        .    .           .

我使用geom_path()作图

HF.95.sim.plt <- ggplot() + 
                 geom_point(data=as.data.frame(Fdata.prev1),aes(year,prev*100)) + 
                 geom_errorbar(data=as.data.frame(Fdata.prev1), aes(x=year,y=prev*100,ymin=lw*100,ymax=up*100)) + 
                 geom_path(data = HIV.prev.HF.Rand.95_m, aes(x = Var2, y = value*100, group = Var1),alpha = 0.2) + 
                 geom_path(data = HIV.prev.HF.Rand.sat_m, aes(x = Var2, y = value*100, group = Var1),color='red') + 
                 ylim(0,2)

HF.95.sim.plt

这仅仅是因为我要一起绘制一百个模拟吗?

0 个答案:

没有答案
相关问题