Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Option to put tags inside of plot borders? #222

Closed
Aariq opened this issue Dec 3, 2020 · 1 comment
Closed

Option to put tags inside of plot borders? #222

Aariq opened this issue Dec 3, 2020 · 1 comment

Comments

@Aariq
Copy link

Aariq commented Dec 3, 2020

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)

@thomasp85
Copy link
Owner

Tag positioning is done through the tag mechanism in ggplot2 and it is highly unlikely that I'll venture outside of the supported modes. You should open an issue in ggplot2 if you want more tag positioning options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants