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.
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,
key.margin = NULL,
frame = NULL,
byrow = NULL,
background = NULL,
margin = NULL,
bracket = NULL,
bracket.size = NULL,
box = NULL,
fence = NULL,
fence.post = NULL,
fence.rail = NULL
)
A <theme>
object that can be provided to a guide.
An <element_text>
setting both
legend.text
and axis.text
elements.
An <element_line>
setting both
legend.axis.line
and axis.line
elements.
An <element_text>
setting both
legend.title
and axis.title
elements.
An <element_text>
setting both
legendry.legend.subtitle
and legendry.axis.subtitle
elements.
One of "top"
,
"right"
, "bottom"
or "right"
setting the following elements:
text.position
: sets only legend.text.position
.
title.position
: sets only legend.title.position
.
subtitle.position
sets both legendry.legend.subtitle.position
and
legendry.axis.subtitle.position
An <element_line>
setting both
axis.ticks
and legend.ticks
elements.
An <element_line>
setting
legendry.legend.minor.ticks
and all 6 of the
axis.ticks.minor.{r/theta/x.top/x.bottom/y.left/y.right}
elements.
An <element_line>
setting both
legendry.legend.mini.ticks
and legendry.axis.mini.ticks
elements.
A
[<unit[1]>
][grid::unit()] setting the following elements:
ticks.length
: sets both legend.ticks.length
and axis.ticks.length
.
minor.ticks.length
sets both axis.minor.ticks.length
and
legendry.legend.minor.ticks.length
.
mini.ticks.length
sets both legendry.axis.mini.ticks.length
and
legendry.legend.mini.ticks.length
.
A [<unit[1]>
][grid::unit()] setting both the
legendry.guide.spacing
and legendry.group.spacing
theme elements.
An <element_rect>
setting the
legend.key
element.
A <unit>
setting the
legend.key.size
, legend.key.width
and legend.key.height
elements
respectively.
A [<unit[1]>
][grid::unit()]
setting the legend.key.spacing
, legend.key.spacing.x
and
legend.key.spacing.y
elements respectively.
A <margin>
setting the margin around
legend glyphs.
An <element_rect>
setting the
legend.frame
element.
A <logical[1]>
setting the legend.byrow
element.
An <element_rect>
setting the
legend.background
element.
A <margin>
setting the legend.margin
element.
An <element_line>
setting the
legendry.bracket
element.
A [<unit[1]>
][grid::unit()] setting the
legendry.bracket.size
element.
An <element_rect>
setting the
legendry.box
element.
An
<element_line>
setting the legendry.fence
,
legendry.fence.post
and legendry.fence.rail
respectively.
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)
)
Run the code above in your browser using DataLab