scale_color_jam | R Documentation |
Apply rainbowJam categorical colors to a ggplot2 object
scale_color_jam(
...,
type = "seq",
palette = 1,
direction = 1,
invert = FALSE,
darkFactor = 1,
sFactor = 1,
darken = FALSE,
alpha = 1,
useGrey = 20,
preset = getOption("colorjam.preset", "dichromat2"),
step = getOption("colorjam.step", "default")
)
... |
additional arguments are passed to |
type |
|
palette |
|
direction |
|
invert |
|
darkFactor , sFactor |
|
darken |
|
alpha |
|
useGrey |
|
This function provides a function in the format scale_color_*
to be applied to ggplot2 objects. It can provide a more visibly
distinct set of categorical colors than ggplot2::scale_color_hue()
.
Other colorjam ggplot2:
jam_pal()
,
scale_fill_jam()
,
theme_jam()
if (jamba::check_pkg_installed("ggplot2")) {
dsamp <- ggplot2::diamonds[sample(nrow(ggplot2::diamonds), 1000),];
d <- ggplot2::ggplot(
dsamp, ggplot2::aes(carat, price)) +
ggplot2::geom_point(ggplot2::aes(colour=cut),
size=4);
print(d + ggplot2::scale_color_hue() + ggplot2::ggtitle("scale_color_hue()"));
print(d + scale_color_jam() + ggplot2::ggtitle("scale_color_jam()"));
print(d + scale_color_jam(preset="ryb") + ggplot2::ggtitle("scale_color_jam(preset='ryb')"));
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.