gg_color_repel {colorrepel}R Documentation

Wrapper to reorder ggplot colors to maximize color differences in space

Description

Wrapper to reorder ggplot colors to maximize color differences in space

Usage

gg_color_repel(
  g = ggplot2::last_plot(),
  col = "colour",
  sim = NULL,
  severity = 0.5,
  verbose = FALSE,
  downsample = 5000,
  nsamp = 50000,
  seed = 34,
  autoswitch = TRUE,
  out_worst = FALSE,
  repel_label = FALSE,
  encircle = FALSE,
  encircle_alpha = 0.25,
  encircle_expand = 0.02,
  encircle_shape = 0.5,
  encircle_threshold = 0.1,
  encircle_nmin = 0.1,
  ...
)

Arguments

g

ggplot plot object

col

colour or fill in ggplot

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

nsamp

how many random sampling color combinations to test, default 50000

seed

sampling randomization seed

autoswitch

try to switch between colour and fill automatically

out_worst

output the worst combination instead of best

repel_label

whether to add centroid labels with ggrepel

encircle

whether to draw geom_encircle by cluster

encircle_alpha

alpha argument passed to geom_encircle

encircle_expand

expand argument passed to geom_encircle

encircle_shape

shape/smoothing argument passed to geom_encircle

encircle_threshold

threshold for removing outliers

encircle_nmin

number of near neighbors for removing outliers

...

passed to repel_label

Value

new ggplot object

Examples

a <- ggplot2::ggplot(ggplot2::mpg, ggplot2::aes(displ, hwy)) +
ggplot2::geom_point(ggplot2::aes(color = as.factor(cyl)))
b <- gg_color_repel(a, col = "colour")

[Package colorrepel version 0.1.0 Index]