[R] add reference lines (or grid) in background

Jose Iparraguirre Jose.Iparraguirre at ageuk.org.uk
Tue Sep 18 11:53:57 CEST 2012


Dear Luigi,

Here's an option:

boxplot(x, boxcol="white", whiskcol="white",medcol="white",staplecol="white")
abline(h=c(-1,0,1))
grid(NA, 4, lwd = 2)
boxplot(x,add=T)

Regards,

José Iparraguirre



-----Original Message-----
From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On Behalf Of Luigi
Sent: 18 September 2012 09:36
To: r-help at r-project.org
Subject: [R] add reference lines (or grid) in background

Dear all,

Is there a simple way to add reference lines in background? I am trying with
abline() or grid() but the lines, since they are executed after the plot
function, are draw on top. How can I draw such lines beneath the main plot?
Here is an example:

 

x<-rnorm(100)

boxplot(x)

abline(h=c(-1,0,1))

grid(NA, 4, lwd = 2)

 

regards,

 

Luigi Marongiu, MSc

 


	[[alternative HTML version deleted]]

______________________________________________
R-help at 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.

Age UK and YouthNet are official charities for the Virgin London Marathon 2013

We need you to Run for it. Join the team and help raise vital funds to bring generations together to combat loneliness and isolation.

Go to http://www.runforit.org.uk for more information or contact Helen Parson at helen.parsons at ageuk.org.uk or on 020 303 31369.

Age UK and YouthNet. A lifeline, online.

www.runforit.org.uk



Age UK Improving later life

www.ageuk.org.uk



-------------------------------
Age UK is a registered charity and company limited by guarantee, (registered charity number 1128267, registered company number 6825798). 
Registered office: Tavis House, 1-6 Tavistock Square, London WC1H 9NA.

For the purposes of promoting Age UK Insurance, Age UK is an Appointed Representative of Age UK Enterprises Limited, Age UK is an Introducer 
Appointed Representative of JLT Benefit Solutions Limited and Simplyhealth Access for the purposes of introducing potential annuity and health 
cash plans customers respectively.  Age UK Enterprises Limited, JLT Benefit Solutions Limited and Simplyhealth Access are all authorised and 
regulated by the Financial Services Authority. 
------------------------------

This email and any files transmitted with it are confide...{{dropped:28}}




More information about the R-help mailing list