library(ggplot2)
ggplot(mtcars, aes(disp, mpg)) +
geom_point() +
labs(
title =
"Fuel economy vs. engine displacement
Lorem ipsum *dolor sit amet,* consectetur adipiscing elit, **sed do eiusmod tempor
incididunt** ut labore et dolore magna aliqua. Ut enim ad
minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea
commodo consequat.",
x = "displacement (in3)",
y = "Miles per gallon (mpg)A measure of
the car's fuel efficiency."
) +
theme(
plot.title.position = "plot",
plot.title = element_textbox_simple(
size = 10,
padding = margin(5.5, 5.5, 5.5, 5.5),
margin = margin(0, 0, 5.5, 0),
fill = "cornsilk"
),
axis.title.x = element_textbox_simple(
width = NULL,
padding = margin(4, 4, 4, 4),
margin = margin(4, 0, 0, 0),
linetype = 1,
r = grid::unit(8, "pt"),
fill = "azure1"
),
axis.title.y = element_textbox_simple(
hjust = 0,
orientation = "left-rotated",
minwidth = unit(1, "in"),
maxwidth = unit(2, "in"),
padding = margin(4, 4, 2, 4),
margin = margin(0, 0, 2, 0),
fill = "lightsteelblue1"
)
)
Run the code above in your browser using DataLab