Skip to contents

Custom discrete fill scale for ggNetView

Usage

scale_fill_ggnetview(
  classes,
  ...,
  others_label = "Others",
  na_value = "#e0e0e0",
  drop = FALSE
)

Arguments

classes

Character string. The discrete class names or factor levels to map to colors.

...

Additional arguments passed to `ggplot2::scale_color_manual()`.

others_label

Character, (default = "Others").

na_value

Color for missing values. Default `"#e0e0e0"`.

drop

Logical, passed to `ggplot2::scale_color_manual()`.

Value

A `ggplot2` scale object.

Examples

library(ggplot2)
df <- data.frame(
  x = 1:4, y = 1:4,
  group = c("Module1", "Module2", "Module3", "Others")
)
ggplot(df, aes(x, y, fill = group)) +
  geom_point(shape = 21, size = 8) +
  scale_fill_ggnetview(df$group)