| scale_color_repel | R Documentation |
scale_color_repel() can be added to a ggplot with +. It calculates a
reordered color palette from the plot object, then adds a manual color scale
using those optimized colors.
scale_color_repel(
nsamp = 50000,
sim = NULL,
severity = 0.5,
verbose = FALSE,
downsample = 5000,
polychrome_recolor = FALSE,
seed = 34,
col = "colour",
autoswitch = TRUE,
layer = 1,
out_worst = FALSE,
...
)
scale_colour_repel(
nsamp = 50000,
sim = NULL,
severity = 0.5,
verbose = FALSE,
downsample = 5000,
polychrome_recolor = FALSE,
seed = 34,
col = "colour",
autoswitch = TRUE,
layer = 1,
out_worst = FALSE,
...
)
scale_fill_repel(
nsamp = 50000,
sim = NULL,
severity = 0.5,
verbose = FALSE,
downsample = 5000,
polychrome_recolor = FALSE,
seed = 34,
col = "fill",
autoswitch = TRUE,
layer = 1,
out_worst = FALSE,
...
)
nsamp |
how many random sampling color combinations to test, default 50000 |
sim |
passing a colorbind simulation function if needed |
severity |
severity of the color vision defect, between 0 and 1 |
verbose |
whether to print messages |
downsample |
downsample when too many datapoints are present, or use chull |
polychrome_recolor |
whether to replace the original colors with polychrome creation |
seed |
sampling randomization seed |
col |
colour or fill in ggplot |
autoswitch |
try to switch between colour and fill automatically |
layer |
layer to detect color, defaults to first |
out_worst |
output the worst combination instead of best |
... |
passed to |
object added to a ggplot with +
a <- ggplot2::ggplot(ggplot2::mpg, ggplot2::aes(displ, hwy)) +
ggplot2::geom_point(ggplot2::aes(color = as.factor(cyl)))
b <- a + scale_color_repel()
c <- ggplot2::ggplot(ggplot2::mpg, ggplot2::aes(class, fill = as.factor(cyl))) +
ggplot2::geom_bar() +
scale_fill_repel()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.