Re: [R] Boxplot intervals combining names

From: Sarah Goslee <sarah.goslee_at_gmail.com>
Date: Sun, 13 Jun 2010 10:08:13 -0400

Hi Ross,

You are indeed missing something simple. If there are 60 bars, the axis runs from 1 to 60, and you want a label at every second one, rather than at every one.

Like this (with 10 instead of 60):

testdata <- matrix(runif(100), ncol=10)
boxplot(testdata, xaxt="n")
axis(1, at=seq(1.5, 9.5, by=2), labels=letters[1:5])

Sarah

On Sun, Jun 13, 2010 at 9:40 AM, RCulloch <ross.culloch_at_dur.ac.uk> wrote:
>
> Hi R users,
>
> This seems like a simple problem but I have searched nabble for the answer
> and can't seem to find it.
>
> All I want to do is produce a boxplot where I have two boxes for one
> Individual but on the xaxis I only have one tick mark centred between the
> boxes so I can add the Individuals' name. I have 30 IDs and have shown the
> code I use below for a couple of IDs, I figure the data is not important
> here so it's not included.
>
> boxplot (ID1[,8],ID1[,9],ID2[,8],ID2[,9],xaxt='n')
>
> I have put all the ID names in as 'names1'
>
> and I have tried numerous variations on axis, e.g.
>
> axis(1,at=1:30,labels=names1)
>
> but nothing works: the boxplot appears to 'know' that there are 60 tick
> marks (data) and therefore only puts ticks half way up the graph, and using:
>
> axis(1,at=1:30,labels=names1)
>
> complains that there is a difference of length, which of course there is!
>
> I must be missing something simple here, but any suggestions would be
> gratefully received,
>
> Ross
>
>
>
>
> --
> View this message in context: http://r.789695.n4.nabble.com/Boxplot-intervals-combining-names-tp2253442p2253442.html
> Sent from the R help mailing list archive at Nabble.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.
>

-- 
Sarah Goslee
http://www.functionaldiversity.org

______________________________________________
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.
Received on Sun 13 Jun 2010 - 14:11:01 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Sun 13 Jun 2010 - 14:50:29 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive