[R] (no subject)
ulrik.stervbo at gmail.com
Fri Jan 8 18:02:25 CET 2016
Your dat.vline should include the 'variable' as you facet on this.
On Fri, 8 Jan 2016 at 17:49 Matthias Worni <wornimatthias at gmail.com> wrote:
> Thank you for the help. It worked out fine. However trying to add
> additional aesthetics I came to another point, where I couldnt figure out a
> way to solve it. Perhaps you run into similar problems since your familiar
> with the ggplot package.
> The code is the following:
> runmean_10yr_Nino_3_Index_17th_century <-
> runmean_10yr_Nino_3_Index_18th_century <-
> runmean_10yr_Nino_3_Index_19th_century <-
> runmean_10yr_Nino_3_Index_20th_century <-
> time_Nino3 <- c(1:100)
> runmean_yearly_decadal_Nino_Index <-
> melted3 <- melt(runmean_yearly_decadal_Nino_Index , id.vars="time_Nino3")
> ggplot(data=melted3, aes(x=time_Nino3,y=value,colour=variable))+
> geom_line()+ ylab("SST Anomaly") + xlab("year") + ggtitle("Decadal El
> Nino Index ")+ facet_grid(variable ~ .) +
> geom_vline(aes(xintercept = xp),data=dat.vline)
> dat.vline <- data.frame( xp = c(15, 23))
> As you may have noticed I created several plots below each other and now I
> would like to add vertical lines to this plots, therefore adding
> "geom_vline(aes(xintercept = xp),data=dat.vline). This worked so far,
> however I would like to add vertical lines for these four different plots
> at different places. Do you know how I could do this? I added the plot I
> created at this e-mail. You can see two lines on every of those 4 plots (at
> the same place). What I want is the same thing but the lines at different
> places for every of those 4 plots (independently). Thank you for the help!!
> If you need to create the plots you can simply change the
> "runmean_10yr_Nino_3_Index_17th_century" to any other vector.
> Best Matthias
> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> PLEASE do read the posting guide
> and provide commented, minimal, self-contained, reproducible code.
[[alternative HTML version deleted]]
More information about the R-help