View source: R/guide-colring.R
guide_colring | R Documentation |
Similar to guide_colourbar()
, this guide
displays continuous colour
or fill
aesthetics. Instead of a bar, the
gradient in shown in a ring or arc, which can be convenient for cyclical
palettes such as some provided in the scico package.
guide_colring(
title = waiver(),
key = "auto",
start = 0,
end = NULL,
outer_guide = "axis_base",
inner_guide = "axis_base",
nbin = 300,
reverse = FALSE,
show_labels = "outer",
theme = NULL,
vanilla = TRUE,
position = waiver(),
available_aes = c("colour", "fill"),
...
)
title |
A |
key |
A standard key specification. Defaults to
|
start , end |
A |
outer_guide , inner_guide |
Guides to display on the outside and inside of the colour ring. Each guide can be specified using one of the following:
|
nbin |
A positive |
reverse |
A |
show_labels |
A |
theme |
A |
vanilla |
A |
position |
A |
available_aes |
A |
... |
Arguments forwarded to the |
A <Guide>
object.
Other standalone guides:
guide_axis_base()
,
guide_axis_dendro()
,
guide_axis_nested()
,
guide_circles()
,
guide_colbar()
,
guide_colsteps()
,
guide_legend_base()
,
guide_legend_cross()
,
guide_legend_group()
# Rings works best with a cyclical palette
my_pal <- c("black", "tomato", "white", "dodgerblue", "black")
p <- ggplot(mpg, aes(displ, hwy, colour = cty)) +
geom_point() +
scale_colour_gradientn(colours = my_pal)
# Standard colour ring
p + guides(colour = "colring")
# As an arc
p + guides(colour = guide_colring(
start = 1.25 * pi, end = 2.75 * pi
))
# Removing the inner tick marks
p + guides(colour = guide_colring(inner_guide = "none"))
# Include labels on the inner axis
p + guides(colour = guide_colring(show_labels = "both"))
# Passing an argument to inner/outer guides
p + guides(colour = guide_colring(angle = 0))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.