2

I am new to R and I have been trying to figure out how to decrease the distance between data in a stripchart.
I want two categories on the x-axis to be closer together. Here's the code I used:

stripchart(Ct ~ NugentScore, data = Avagdata, vertical = TRUE, method = 'jitter', jitter = 0.1, pch = 16)

It creates a stripchart similar to the one under stripchart vs beeswarm. http://www.cbs.dtu.dk/~eklund/beeswarm/ For example, I would want categories A and B on the x-axis to be closer together (the data and the labels). The difference is my graph only has two categories on the x-axis.

Any suggestions? Any help would be greatly appreciated!

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129

1 Answers1

2

The 'at' argument seems effective:

stripchart(decrease ~ treatment,
     main = "stripchart(OrchardSprays)",
     vertical = TRUE, log = "y", 
     at=seq(1,length.out=length(unique(OrchardSprays $treatment)), by=0.5), 
     data = OrchardSprays)
?stripchart
IRTFM
  • 258,963
  • 21
  • 364
  • 487
  • This fixed one problem, but created another. Now, the x-axis extends too far past the data. The graph is here: http://tinypic.com/r/2vm5zm1/5. – user2860535 Oct 09 '13 at 14:26
  • 1
    That seems a predictable effect of moving items closer together. You need to describe your goals better. If the goal is to bunch the strips cloase but keep them ceneter .... then you need to say so. – IRTFM Oct 09 '13 at 16:21
  • 1
    Sorry about that. I'm just started using R yesterday actually and I didn't know what the result would be. I'm still learning what I need to ask. – user2860535 Oct 09 '13 at 20:06