This function has shorthand names for theme elements relating to guides. It
is intended to be used as the guide_*(theme)
argument. Because of this
intent, and due to legends and axes having mutually exclusive theme elements,
this function sets the elements for both simultaneously.
Usage
theme_guide(
text = NULL,
line = NULL,
title = NULL,
subtitle = NULL,
text.position = NULL,
title.position = NULL,
subtitle.position = NULL,
ticks = NULL,
minor.ticks = NULL,
mini.ticks = NULL,
ticks.length = NULL,
minor.ticks.length = NULL,
mini.ticks.length = NULL,
spacing = NULL,
group.spacing = NULL,
key = NULL,
key.size = NULL,
key.width = NULL,
key.height = NULL,
key.spacing = NULL,
key.spacing.x = NULL,
key.spacing.y = NULL,
frame = NULL,
byrow = NULL,
background = NULL,
margin = NULL,
bracket = NULL,
bracket.size = NULL,
box = NULL,
fence = NULL,
fence.post = NULL,
fence.rail = NULL
)
Arguments
- text
An
<element_text>
setting bothlegend.text
andaxis.text
elements.- line
An
<element_line>
setting bothlegend.axis.line
andaxis.line
elements.- title
An
<element_text>
setting bothlegend.title
andaxis.title
elements.- subtitle
An
<element_text>
setting bothlegendry.legend.subtitle
andlegendry.axis.subtitle
elements.- text.position, title.position, subtitle.position
One of
"top"
,"right"
,"bottom"
or"right"
setting the following elements:text.position
: sets onlylegend.text.position
.title.position
: sets onlylegend.title.position
.subtitle.position
sets bothlegendry.legend.subtitle.position
andlegendry.axis.subtitle.position
- ticks
An
<element_line>
setting bothaxis.ticks
andlegend.ticks
elements.- minor.ticks
An
<element_line>
settinglegendry.legend.minor.ticks
and all 6 of theaxis.ticks.minor.{r/theta/x.top/x.bottom/y.left/y.right}
elements.- mini.ticks
An
<element_line>
setting bothlegendry.legend.mini.ticks
andlegendry.axis.mini.ticks
elements.- ticks.length, minor.ticks.length, mini.ticks.length
A [
<unit[1]>
][grid::unit()] setting the following elements:ticks.length
: sets bothlegend.ticks.length
andaxis.ticks.length
.minor.ticks.length
sets bothaxis.minor.ticks.length
andlegendry.legend.minor.ticks.length
.mini.ticks.length
sets bothlegendry.axis.mini.ticks.length
andlegendry.legend.mini.ticks.length
.
- spacing, group.spacing
A [
<unit[1]>
][grid::unit()] setting both thelegendry.guide.spacing
andlegendry.group.spacing
theme elements.- key
An
<element_rect>
setting thelegend.key
element.- key.size, key.width, key.height
A
<unit>
setting thelegend.key.size
,legend.key.width
andlegend.key.height
elements respectively.- key.spacing, key.spacing.x, key.spacing.y
A [
<unit[1]>
][grid::unit()] setting thelegend.key.spacing
,legend.key.spacing.x
andlegend.key.spacing.y
elements respectively.- frame
An
<element_rect>
setting thelegend.frame
element.- byrow
A
<logical[1]>
setting thelegend.byrow
element.- background
An
<element_rect>
setting thelegend.background
element.- margin
A
<margin>
setting thelegend.margin
element.- bracket
An
<element_line>
setting thelegendry.bracket
element.- bracket.size
A [
<unit[1]>
][grid::unit()] setting thelegendry.bracket.size
element.- box
An
<element_rect>
setting thelegendry.box
element.- fence, fence.post, fence.rail
An
<element_line>
setting thelegendry.fence
,legendry.fence.post
andlegendry.fence.rail
respectively.
Examples
red_ticks <- theme_guide(ticks = element_line(colour = "red", linewidth = 0.5))
# Both axis and colourbar gain red ticks
ggplot(mpg, aes(displ, hwy, colour = cty)) +
geom_point() +
guides(
colour = guide_colourbar(theme = red_ticks),
x = guide_axis(theme = red_ticks)
)