Description Usage Arguments Examples
Change the appearance of the main title, subtitle, caption, axis
labels and text, as well as the legend title and texts. Wrapper around
element_text()
.
1 |
object |
character string specifying the plot components. Allowed values include:
|
size |
numeric value specifying the font size, (e.g.: |
color |
character string specifying the font color, (e.g.: |
face |
the font face or style. Allowed values include one of
|
family |
the font family. |
... |
other arguments to pass to the function
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | # Load data
data("ToothGrowth")
# Basic plot
p <- ggboxplot(ToothGrowth, x = "dose", y = "len", color = "dose",
title = "Box Plot created with ggpubr",
subtitle = "Length by dose",
caption = "Source: ggpubr",
xlab ="Dose (mg)", ylab = "Teeth length")
p
# Change the appearance of titles and labels
p +
font("title", size = 14, color = "red", face = "bold.italic")+
font("subtitle", size = 10, color = "orange")+
font("caption", size = 10, color = "orange")+
font("xlab", size = 12, color = "blue")+
font("ylab", size = 12, color = "#993333")+
font("xy.text", size = 12, color = "gray", face = "bold")
# Change the appearance of legend title and texts
p +
font("legend.title", color = "blue", face = "bold")+
font("legend.text", color = "red")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.