apply_scaling | R Documentation |
This function applies only the size-based theme modifications from the
theme_cr()
function. It does not include %+replace%
,
so it can be applied on top of pre-existing theme modifications (e.g.,
the theme_cut()
functions).
apply_scaling(plot_scale = 1, font_scale = 1, set_margin = TRUE)
plot_scale |
Scaling factor for the plot components as a whole. A value of 1 corresponds to a font size of 12 pt and a figure size of 6" by 4" |
font_scale |
Scaling factor for the font as compared to the plot. A value of 1 will scale the font to the plot size. Larger numbers make the font large compared to the plot size; smaller numbers make the font small compared to the plot size. |
set_margin |
Flag for whether or not to change the plot margin from the baseline. Used as a separate option because it is difficult to specifically adjust when plots are combined. |
A list containing the theme properties.
library(ggplot2)
df <- data.frame(x = 1:5, y = 1:5, z = c("a", "b", "c", "b", "c"))
p <- ggplot(df, aes(x, y, color = z)) + geom_point()
## Not run:
p + theme_cr() # Uses default scaling and font
# Multiply height and width of the plot by 2
p + theme_cr() + apply_scaling(plot_scale = 2)
# Divide height and width of plot by 2 but keep original font size
p + theme_cr() + apply_scaling(plot_scale = 0.5, font_scale = 2)
# Multiply height and width of the plot by 2 but do not change the margins
p + theme_cr() + apply_scaling(plot_scale = 2, set_margin = FALSE)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.