Skip to content

Option to put tags inside of plot borders? #222

@Aariq

Description

@Aariq

Some journals, like Oecologia, require panel tags to be inside of plot boundaries. Using theme(plot.tag = element_text(hjust = , vjust = ) is fiddly and doesn't put tags in consistent distance from plot borders.

library(ggplot2)
library(patchwork)

p1 <- ggplot(mtcars) + geom_point(aes(mpg, disp))
p2 <- ggplot(mtcars) + geom_boxplot(aes(gear, disp, group = gear))
p3 <- ggplot(mtcars) + geom_smooth(aes(disp, qsec))


(p1 | p2 | p3) +plot_annotation(tag_levels = "a", tag_prefix = "|", tag_suffix = "|") &
  theme(plot.tag.position = c(0,1),
        plot.tag = element_text(hjust = -2.5, vjust = 1))
#> `geom_smooth()` using method = 'loess' and formula 'y ~ x'

Created on 2020-12-03 by the reprex package (v0.3.0)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions