translate_plot: Translate all text in plot

View source: R/translate_plot.R

translate_plotR Documentation

Translate all text in plot

Description

Translate all text in plot

Usage

translate_plot(plot, trans)

Arguments

plot

A plot to translate

trans

A named vector of translations

Examples

p <- ggplot(mtcars, aes(x = wt, y=mpg)) + geom_point() +
     labs(title = "Test plot", caption = "Source: some")
translation <- c("Test plot" = "Testikuvio", wt = "Paino",
                 mpg = "Mailia per gallona", Source = "Lähde")
p2 <- translate_plot(p, translation)

library(patchwork)
pp <- p / ((p + geom_point(colour = "blue")) + (p + geom_point(colour = "red")))
pp2 <- translate_plot(pp, translation)

pttry/ggptt documentation built on May 4, 2023, 2:48 p.m.