Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

diverging_pal

Diverging palette


Description

This is the ‘PuOr’ palette from https://colorbrewer2.org/. It has at most eleven colors.

Usage

diverging_pal(n)

Arguments

n

The number of colors in the palette. The maximum is eleven currently.

Details

This is similar to sequential_pal, but it also puts emphasis on the mid-range values, plus the the two extreme ends. Use this palette, if you have such a quantity to mark with vertex colors.

Value

A character vector of RGB color codes.

See Also

Other palettes: categorical_pal(), r_pal(), sequential_pal()

Examples

## Not run: 
library(igraphdata)
data(foodwebs)
fw <- foodwebs[[1]] %>%
  induced_subgraph(V(.)[ECO == 1]) %>%
  add_layout_(with_fr()) %>%
  set_vertex_attr("label", value = seq_len(gorder(.))) %>%
  set_vertex_attr("size", value = 10) %>%
  set_edge_attr("arrow.size", value = 0.3)

V(fw)$color <- scales::dscale(V(fw)$Biomass %>% cut(10), diverging_pal)
plot(fw)

data(karate)
karate <- karate %>%
  add_layout_(with_kk()) %>%
  set_vertex_attr("size", value = 10)

V(karate)$color <- scales::dscale(degree(karate) %>% cut(5), diverging_pal)
plot(karate)

## End(Not run)

igraph

Network Analysis and Visualization

v1.2.10
GPL (>= 2)
Authors
See AUTHORS file.
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.