[R] How to add a line on the boxplot

2006-07-22 Thread Jiantao Shi
Hi,
I have a data frame,

 df=rnorm(1000)
 dim(df)=c(100,10)

And i can get the boxplot,

 boxplot(data.frame(df))


So how can add a line (aline) on the existing boxplot,eg,
aline=apply(df,2,max)

Thanks in advance.

[[alternative HTML version deleted]]

__
R-help@stat.math.ethz.ch 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.


Re: [R] How to add a line on the boxplot

2006-07-22 Thread Uwe Ligges
Jiantao Shi wrote:

 Hi,
 I have a data frame,
 
 
df=rnorm(1000)
dim(df)=c(100,10)

 
 And i can get the boxplot,
 
 
boxplot(data.frame(df))
 
 
 
 So how can add a line (aline) on the existing boxplot,eg,
 
 
 Thanks in advance.

Example:


df - rnorm(1000)
dim(df) - c(100,10)
boxplot(data.frame(df))
aline - apply(df, 2, max)

# , now you might want either
abline(h = aline, col = green, lty=dotted)
# or
segments(seq(along = aline) - 0.2, aline,
  seq(along = aline) + 0.2, aline,
  lwd = 2, col = red)



Uwe Ligges




   [[alternative HTML version deleted]]
 
 __
 R-help@stat.math.ethz.ch 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.

__
R-help@stat.math.ethz.ch 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.


Re: [R] How to add a line on the boxplot

2006-07-22 Thread Jiantao Shi
Thanks
The first method,i get many lines,using the second,i get segments.I actually
need one line with y coordinate defined by aline,x along the boxplot.


On 7/22/06, Uwe Ligges [EMAIL PROTECTED] wrote:

 Jiantao Shi wrote:

  Hi,
  I have a data frame,
 
 
 df=rnorm(1000)
 dim(df)=c(100,10)
 
 
  And i can get the boxplot,
 
 
 boxplot(data.frame(df))
 
 
 
  So how can add a line (aline) on the existing boxplot,eg,
 
 
  Thanks in advance.

 Example:


 df - rnorm(1000)
 dim(df) - c(100,10)
 boxplot(data.frame(df))
 aline - apply(df, 2, max)

 # , now you might want either
 abline(h = aline, col = green, lty=dotted)
 # or
 segments(seq(along = aline) - 0.2, aline,
  seq(along = aline) + 0.2, aline,
  lwd = 2, col = red)



 Uwe Ligges




[[alternative HTML version deleted]]
 
  __
  R-help@stat.math.ethz.ch 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.



[[alternative HTML version deleted]]

__
R-help@stat.math.ethz.ch 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.


Re: [R] How to add a line on the boxplot

2006-07-22 Thread Uwe Ligges
Jiantao Shi wrote:
 Thanks
 The first method,i get many lines,using the second,i get segments.I 
 actually
 need one line with y coordinate defined by aline,x along the boxplot.

Do you mean lines(aline)?
If not, please explain in another way how you want to arrange those 10 
values and make lines from it.

Uwe Ligges



 
 On 7/22/06, Uwe Ligges [EMAIL PROTECTED] wrote:

 Jiantao Shi wrote:

  Hi,
  I have a data frame,
 
 
 df=rnorm(1000)
 dim(df)=c(100,10)
 
 
  And i can get the boxplot,
 
 
 boxplot(data.frame(df))
 
 
 
  So how can add a line (aline) on the existing boxplot,eg,
 
 
  Thanks in advance.

 Example:


 df - rnorm(1000)
 dim(df) - c(100,10)
 boxplot(data.frame(df))
 aline - apply(df, 2, max)

 # , now you might want either
 abline(h = aline, col = green, lty=dotted)
 # or
 segments(seq(along = aline) - 0.2, aline,
  seq(along = aline) + 0.2, aline,
  lwd = 2, col = red)



 Uwe Ligges




[[alternative HTML version deleted]]
 
  __
  R-help@stat.math.ethz.ch 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.




__
R-help@stat.math.ethz.ch 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.