scale_cr | R Documentation |
Uses the provided color palette
for the color
or fill
aesthetics of a ggplot2 object. The function will use
scale_discrete
when the colors are selected with
ncol
or colors
and will use scale_manual
when the colors are selected with names
.
scale_color_cr(
palette = "default",
ncol = NULL,
colors = NULL,
species = NULL,
alpha = 1,
...
)
scale_fill_cr(
palette = "default",
ncol = NULL,
colors = NULL,
species = NULL,
alpha = 1,
...
)
palette |
Character vector of length 1 defining the palette to select
colors from; use |
ncol |
Range of colors to select from |
colors |
Names of colors to select from |
species |
Names of species to select from |
alpha |
new alpha level in [0,1]. If alpha is |
... |
Additional parameters for |
library(ggplot2)
df <- data.frame(x = 1:5, y = 1:5, z = c("IL6", "IL8", "IL6R", "IL6", "IL8"))
p <- ggplot(df, aes(x, y, color = z)) + geom_point()
# Using the colors without name-matching
p + scale_color_cr(palette = "receptors")
# Matching the colors to the species names
p + scale_color_cr(palette = "receptors", species = unique(df$z))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.