How do I change the color value of just one value in ggplot2’s scale_fill_brewer?

The package RColorBrewer contains the palettes and you can use the function brewer.pal to return a colour palette of your choice. For example, a sequential blue palette of 5 colours: library(RColorBrewer) my.cols <- brewer.pal(5, “Blues”) my.cols [1] “#EFF3FF” “#BDD7E7” “#6BAED6” “#3182BD” “#08519C” You can get a list of valid palette names in the ?brewer.pal help … Read more

How to generate a number of most distinctive colors in R?

I joined all qualitative palettes from RColorBrewer package. Qualitative palettes are supposed to provide X most distinctive colours each. Of course, mixing them joins into one palette also similar colours, but that’s the best I can get (74 colors). library(RColorBrewer) n <- 60 qual_col_pals = brewer.pal.info[brewer.pal.info$category == ‘qual’,] col_vector = unlist(mapply(brewer.pal, qual_col_pals$maxcolors, rownames(qual_col_pals))) pie(rep(1,n), col=sample(col_vector, … Read more