RINNER Heinrich
2009-Sep-03 15:24 UTC
[R] putting reference lines or grids into the background of a plot
Dear R-community, using R.2.9.1, how do you put reference lines or grids into the _background_ of a plot? For example: barplot(3:1) abline(h = seq(0.5, 2.5 ,0.5), col = "red", lty = "dashed") -> The lines are before the bars (and the line parts going through the bars might be considered as "chart junk", I suppose). Now, in this toy example I could just do the plot again to get the desired result: barplot(3:1, add = TRUE) But is that really in general the "natural" way to do this? Maybe I am just missing some graphical parameter that I could change (though I was not able to find one)... Thanks, Heinrich.
baptiste auguie
2009-Sep-03 15:45 UTC
[R] putting reference lines or grids into the background of a plot
Hi, You may find some inspiration here: http://wiki.r-project.org/rwiki/doku.php?id=tips:graphics-misc:ggplot2theme_inbase HTH, baptiste 2009/9/3 RINNER Heinrich <HEINRICH.RINNER@tirol.gv.at>> Dear R-community, > > using R.2.9.1, how do you put reference lines or grids into the > _background_ of a plot? > For example: > > barplot(3:1) > abline(h = seq(0.5, 2.5 ,0.5), col = "red", lty = "dashed") > > -> The lines are before the bars (and the line parts going through the bars > might be considered as "chart junk", I suppose). > > Now, in this toy example I could just do the plot again to get the desired > result: > > barplot(3:1, add = TRUE) > > But is that really in general the "natural" way to do this? > Maybe I am just missing some graphical parameter that I could change > (though I was not able to find one)... > > Thanks, > Heinrich. > > ______________________________________________ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. >-- _____________________________ Baptiste AuguiƩ School of Physics University of Exeter Stocker Road, Exeter, Devon, EX4 4QL, UK http://newton.ex.ac.uk/research/emag ______________________________ [[alternative HTML version deleted]]