A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/tidyverse/ggplot2/issues/4297 below:

tag position inside plot borders · Issue #4297 · tidyverse/ggplot2 · GitHub

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)


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4