element_marquee {marquee} | R Documentation |
ggplot2 theme element supporting marquee syntax
Description
This theme element is a drop-in replacement for ggplot2::element_text()
. It
works by integrating the various style settings of the element into the base
style of the provided style set. If a margin is given, it is set on the body
tag with skip_inherit()
. The default width is NA
meaning that it will
span as long as the given text is, doing no line wrapping. You can set it to
any unit to make it fit within a specific width. However, this may not work
as expected with rotated text (you may get lucky). Note that you may see
small shifts in the visuals when going from element_text()
to
element_marquee()
as size reporting may differ between the two elements.
Usage
element_marquee(
family = NULL,
colour = NULL,
size = NULL,
hjust = NULL,
vjust = NULL,
angle = NULL,
lineheight = NULL,
color = NULL,
margin = NULL,
style = NULL,
width = NULL,
inherit.blank = FALSE
)
Arguments
family |
The font family of the base style |
colour , color |
The font colour of the base style |
size |
The font size of the base style |
hjust |
Horizontal justification (in |
vjust |
Vertical justification (in |
angle |
Angle (in |
lineheight |
The lineheight of the base style |
margin |
The margin for the body tag |
style |
A style set to base the rendering on |
width |
The maximum width of the text. See the description for some caveats for this |
inherit.blank |
Should this element inherit the existence of an
|
Value
An element_marquee
object that can be used in place of
element_text
in ggplot2 theme specifications
Examples
library(ggplot2)
p <- ggplot(mtcars) +
geom_point(aes(mpg, disp)) +
labs(title = "A {.red *marquee*} title\n* Look at this bullet list\n\n* great, huh?") +
theme_gray(base_size = 6) +
theme(title = element_marquee())
plot(p)
ggplot(mtcars) +
geom_histogram(aes(x = mpg)) +
labs(title =
"I put a plot in your title so you can plot while you title
![](p)
What more could you _possibly_ want?") +
theme(title = element_marquee())