Re: [R] Any ideas on how to add a dotted line to a box plot to indicate a specific value?

From: Paul Murrell <p.murrell_at_auckland.ac.nz>
Date: Thu 26 May 2005 - 09:54:38 EST

Hi

BJ wrote:
> Basically, i want to create a boxplot from population data, with a solid
> line for the median, and then a dotted line for a specific persons
> value. Is there a way to artificially introduce another line or mark of
> some kind in a box plot? Thanks again for all of yoru help. Hopefully
> soon I wont have to keep bugging you all. ~Erithid :-p

Do you mean something like this ... ?

with(ToothGrowth,

      {
        boxplot(len ~ supp)
        # boxplots horizontally centred at 1 and 2
        # 0.6, 1.4 come from default boxwex of 0.8
        #   (1 +/- boxwex/2)
        # 18 I made up
        lines(c(0.6, 1.4), c(18, 18),
              lty="dashed", col="red")
      })

Paul

-- 
Dr Paul Murrell
Department of Statistics
The University of Auckland
Private Bag 92019
Auckland
New Zealand
64 9 3737599 x85392
paul@stat.auckland.ac.nz
http://www.stat.auckland.ac.nz/~paul/

______________________________________________
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
Received on Thu May 26 10:01:24 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:32:06 EST