# Overplotting solution for black-and-white graphics

**Val Systems**, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)

Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

I’m working on producing some black and white graphics of data which has a lot of overplotting. There are three basic groups, which if I made the plot in ordinary full color ggplot2 would look like this (the code for the reverse-log x-axis is available in this gist, and the code for stat_ellipse() is available in this github repository).

For a black and white image, however, it’s trickier. I don’t usually find grey color scales to be sufficiently different for a plot like this, so I’d go for different point shapes. Unfortunately, the default shape scale in ggplot2 isn’t very distinct in this case.

My first strategy to improve things was to add a custom shape scale, with alternating empty vs solid point shapes.

Better, but not great. All the overplotting of the empty point shapes creates this awful indiscriminate mash in the middle of the clusters.

My solution to this problem was to use filled points. While point shapes 1 and 5 in R correspond to an empty circle and an empty diamond, respectively, point shapes 21 and 23 correspond to a filled circle and a filled diamond, respectively, where the fill color and the border color can be different. So, I used shapes 21 and 23 instead of 1 and 5, and set the fill color to be white.

I think it’s a big improvement. Here’s one more iteration, filling the points with a light grey shade instead of white, just for some aesthetic appeal.

**leave a comment**for the author, please follow the link and comment on their blog:

**Val Systems**.

R-bloggers.com offers

**daily e-mail updates**about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.

Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.