[R] Adding horizontal lines to Boxplot
Petr PIKAL
petr.pikal at precheza.cz
Fri Oct 19 11:52:12 CEST 2007
Hi
r-help-bounces at r-project.org napsal dne 19.10.2007 11:24:23:
> 2007/10/19, Frede Aakmann Tøgersen <FredeA.Togersen at agrsci.dk>:
> >
> > So where is the reproducable example?
> >
> > How can we know that you're not doing
> >
> > boxplot(1:10)
> > abline(h = 400, col = "red")?
> >
> > best regards
> >
> > Frede
>
>
> You are right, a reproducable example should have been there.
>
> I don't know what I mistyped but I got to work and here is an example
that
> works,
>
> boxplot(3.2:5.2, 1.9:3.9,3.9:5.9)
> abline(h = 4)
> abline(h = 2.5, col = "green")
> abline(h = 2, col = "red")
> abline(h = 5.5, col = "green")
> abline(h = 6, col = "red")
>
> I also tested with the lwd parameter of the abline
>
> boxplot(3:5, 2:4,4:6)
> abline(h = 4)
> abline(h = 2.5, col = "red", lwd = 2)
> abline(h = 5.5, col = "red", lwd = 2)
>
> Is it possible to scale the size of the boxplot, so that scale on the Y
axis
> is say from 0 to 8 instead of 2 to 6 as it is in the example from above.
You can set any limits to axes by xlim or ylim commands, so in your case
boxplot(..., ylim=c(0,8))
Look also at ?par where you can find various parameter which can be used
in plot commands.
And maybe also to ?bxp help page which gives you plenty of other options
how to customise your plot.
Regards
Petr
>
>
>
> --
> Klaus F. Østergaard, <farremosen(at)gmail dot com>
> ______________________________________________
> 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.
More information about the R-help
mailing list