intrinsic spacing…

Status Quo

Experiment

library(tidyverse)

# use geom label as text - making label disappear
ggplot(cars) + 
  aes(speed, dist) + 
  geom_point() +
  geom_label(label = "Point", 
             label.padding = unit(0.2, "lines"),
             vjust = 1, 
             hjust = 0,
             alpha = 0, # remove background
             linewidth = 0, # not available
             check_overlap = T)
## Warning in geom_label(label = "Point", label.padding = unit(0.2, "lines"), :
## Ignoring unknown parameters: `linewidth` and `check_overlap`

# nice to have text padding
ggplot(cars) + 
  aes(speed, dist) + 
  geom_point() +
  geom_text(label = "Point", 
            label.padding = unit(0.2, "lines"), # nice to have...
            vjust = 1, 
            hjust = 0,
            check_overlap = T)
## Warning in geom_text(label = "Point", label.padding = unit(0.2, "lines"), :
## Ignoring unknown parameters: `label.padding`

GeomLabel$default_aes
## Aesthetic mapping: 
## * `colour`     -> "black"
## * `fill`       -> "white"
## * `size`       -> 3.88
## * `angle`      -> 0
## * `hjust`      -> 0.5
## * `vjust`      -> 0.5
## * `alpha`      -> NA
## * `family`     -> ""
## * `fontface`   -> 1
## * `lineheight` -> 1.2
library(ggplot2)

# check_overlap ... that this argument is not supported by geom_label()
ggplot(cars) + 
  aes(speed, dist) + 
  geom_point() +
  geom_label(label = "Point", 
             label.padding = unit(0.2, "lines"),
             vjust = 1, 
             hjust = 0,
             alpha = 0, # remove background
             label.size = 0) # remove border

df <- data.frame(
  x = c(1, 1, 2, 2, 1.55),
  y = c(1, 2, 1, 2, 1.25),
  text = c("bottom-left", "top-left", "bottom-right", "top-right", "center")
)
ggplot(df, aes(x, y)) +
  geom_text(aes(label = text))
ggplot(df, aes(x, y)) +
  geom_point() + 
  geom_text(aes(label = text), vjust = "inward", hjust = "inward")

Closing remarks, Other Relevant Work, Caveats