0

I want to make a vertical strip chart in R but I want the plotted points to be weighted so that points with greater weights appear bigger. Normally I'd use cex or symbols() but I have 86 points, so these make the points overlap onto each other and hard to distinguish.

Thus, I'd like to use horizontal lines as my points and to have those lines be longer, but not thicker, as weight increases. Histogram also seems to not be good here but maybe I'm just missing something.

This code builds some sample data that looks like mine:

freqs <- c(15, 50, 110, 13, 290, 13, 14, 12, 66, 48)
scores <- c(2.1, 1.4, 2.2, 0.9, 0.9, 1.0, 1.0, 1.1, 2.5, 1.6)
mydata <- data.frame(scores, freqs)

And this code produces a strip chart that is close to what I'm looking for but doesn't elongate the "-" points based on freqs:

par("mar")
par(mar=c(1,1,1,1))
stripchart(mydata$scores
       , vertical = TRUE
       , ylim = c(0.5,3.5)
       , pch = "-"
)
Andrew
  • 1
  • 1
  • 1
    It would be useful to include the code you are using and the resulting plot, to better describe what is desired. – Ajean May 12 '16 at 16:17
  • You may consider using semi-transparent points to mitigate the overlap issue. Or instead of size you could use scale the points by color to show their weight. This link (http://docs.ggplot2.org/0.9.3.1/geom_point.html) might provide some ideas. These plotting techniques are available in `ggplot2` as well as in base `r` – BarkleyBG May 12 '16 at 16:27
  • @Andrew, please edit your code into your question. Also, note that that isn't quite a [reproducible example](http://stackoverflow.com/q/5963269/1217536), please add one (info at link). – gung - Reinstate Monica May 12 '16 at 17:19
  • @BarkleyBG, I agree that shading is an option but it seems like for this issue long lines would be much easier for the audience to interpret. – Andrew May 12 '16 at 18:29

0 Answers0