Skip to content

tag position inside plot borders #4297

@Aariq

Description

@Aariq

Some peer-reviewed journals (e.g. Oecologia) require figure panel labels to be inside of plot borders (although they seem to enforce these requirements inconsistently). It would be nice if there were an option like theme(plot.tag.position = "topleftinner") to place a label at the upper left corner of the inside of plot borders. Currently, I think I have to kludge this by tweaking theme(plot.tag = element_text(vjust = , hjust = ), but it's inconsistent, so I have to do this tweaking for every panel individually. Maybe there's an easier way that I don't know about?

Related to: thomasp85/patchwork#222

library(ggplot2)
p1 <- ggplot(mtcars) + geom_point(aes(mpg, disp)) + labs(tag = "a)")
p1 + theme(plot.tag.position = c(0,1),
           plot.tag = element_text(vjust = 1.5, hjust = -2.85))

# left of "a" just touching plot border

p3 <- ggplot(mtcars) + geom_smooth(aes(disp, qsec)) + labs(tag = "b)")
p3 + theme(plot.tag.position = c(0,1),
           plot.tag = element_text(vjust = 1.5, hjust = -2.85))
#> `geom_smooth()` using method = 'loess' and formula 'y ~ x'

# "b)" is slightly further in with same theme()

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    featurea feature request or enhancement

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions