Set a "basic size" for geom_label in ggplot2 so that minimal value is still readable

Viewed 514

I want to use "size" as an aesthetic in geom_label. My problem is that the minimum label size is so small that the corresponding label is barely readable.

Is there a way to set something like a "minimal size" when using the size aesthetic? If there is a way, it should also work to specify a maximum label size, right?

I tried the theme_minimal(base_size = 15), but this changes all the sizes in the plot.

Small reproducible example:

library(ggplot2)

data <- data.frame(title = c("too small!!!", "just right", "quite big"),
                   x.value = 1:3,
                   y.value = 1:3,
                   size.value = c(1, 5, 10))
ggplot(data, aes(x = x.value, y = y.value, size = size.value, label = title)) +
  geom_label()

Example plot with the label in the lower-left too small

Thanks!

1 Answers

There indeed as a way using scale_size and the range parameter:

ggplot(data, aes(x = x.value, y = y.value, size = size.value, label = title)) +
  geom_label() + scale_size(range = c(0.5, 6))

enter image description here

Related