[R] Manipulating x axis in stripchart

Judith Flores juryef at yahoo.com
Wed Nov 21 04:04:34 CET 2007


Hi all,

   I I need to manipulate the x axis in a stripchart.
I will use one of the data sets included in R to
explain what I need to do.

attach(ToothGrowth)

stripchart(len[supp=='VC']~dose[supp=='VC'],
vertical=TRUE, group.names=c('A','A','A'))

stripchart(len[supp=='OJ']~dose[supp=='OJ'], add=TRUE,
vertical=TRUE, at=c(1:3)+.1,
group.names=c('B','B','B'))

As you can read from the code above, I wanted to add
the 'B' to the x axis to diffrenciate each pair of
strips from each other. But only the 'A's appear.

I tried something like this too, but now '.5','1' and
'2' along with the 'A' and 'B'.

attach(ToothGrowth)

stripchart(len[supp=='VC']~dose[supp=='VC'],
vertical=TRUE)
axis(side=1,labels=c('A','B','A','B','A','B'),
at=c(.4,.5,.9,1.1,1.9,2.1))


stripchart(len[supp=='OJ']~dose[supp=='OJ'], add=TRUE,
vertical=TRUE, at=c(1:3)+.1)

And finally I tried setting par(xaxt='n') before
stripchart, but then I can't add anything to the x
axis.

  Is there a way to manipulate the x axis in a
stripchart like this?

Thank you very much in advance for your help,

Judith



More information about the R-help mailing list