Stack dotplot labels using ggplot

Viewed 47

I am trying to create a simple dotplot that contains 100+ points, some of which are grouped close together. I need the points to be individually labeled, but I would like to stack the labels for points that are close together on top of each other.

Basically, I would like to create a similar dotplot with labeling to the graph below.

dot label example

As a code example, consider the following code where I would like to add the car name to the dotplot in a way similar to the graphic.

ggplot(mtcars, aes(x = mpg)) +
  geom_dotplot(binwidth = .4, stackdir = "centerwhole") +
  scale_y_continuous(NULL, breaks = NULL)
0 Answers
Related