[R] Need data labels to jitter with datapoints in boxplot

MacQueen, Don macqueen1 at llnl.gov
Fri Sep 18 17:01:34 CEST 2015

How about jittering outside the plot?

That is, insert
  df$jNum <- jitter(df$Number)
somewhere before the plot commands, then use jNum in your plots instead of


Don MacQueen

Lawrence Livermore National Laboratory
7000 East Ave., L-627
Livermore, CA 94550

On 9/17/15, 8:20 AM, "R-help on behalf of smheas"
<r-help-bounces at r-project.org on behalf of sheasley at aegonusa.com> wrote:

>Hello, I have created a boxplot with the data points overlayed on top
>the below code. I am happy with the way the datapoints are jittered,
>I cannot figure out how to get the labels to jitter along with the
>datapoints. The labels remain in the center and are unreadable. I have
>a lot of different ways to get them to jitter but can't seem to make it
>work. I have also tried making the label font smaller, but they still
>overlap too much. Note I cannot use the method of assigning the lcoation
>each label - there are too many and this graph will be updated frequently
>with new data. I greatly appreciate your help. Thanks.
>After reading in data...
>#load packages
>#change letter to factor
>#create boxplot
>#Add formatting
>plot<-plot + geom_text(aes(label=Identifier),size=3)
>ggsave(filename="Spreads Plot.pdf",plot=plot,width=11,height=8,units="in")
>Sample Data:
>Identifier	Letter	Number
>AB	AA-	46.74
>BC	A	59.62
>CD	A	61.63
>DE	A	69.49
>EF	A+	69.73
>FG	A+	74.57
>GH	A	75.01
>HI	A	77.52
>IJ	A	77.52
>JK	A	80.12
>KL	A	80.14
>LM	A-	80.35
>MN	A	81.98
>NO	A-	82.72
>OP	A+	83.56
>PQ	A	85.29
>QR	A-	85.46
>RS	A-	85.92
>ST	A	86.11
>TU	A-	86.55
>UV	A	86.57
>VW	A	88.32
>WX	A	89.4
>XY	A-	96.81
>YZ	A+	97.6
>BA	A-	101.86
>CB	A	102.37
>DC	A	104.29
>ED	A	104.92
>FE	A	106.29
>GF	A-	111.84
>HG	A+	121.91
>IH	A-	123.64
>View this message in context:
>Sent from the R help mailing list archive at Nabble.com.
>R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
>PLEASE do read the posting guide
>and provide commented, minimal, self-contained, reproducible code.

More information about the R-help mailing list