Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to avoid calling scale_color_manual all the time

Tags:

r

ggplot2

I have plots with all the same values in scale_color_manual. I want to avoid this and just call one time a function like this : theme(manual_colors = c("#000000", "#111111"))

Is it possible ?

like image 905
Rodolphe LAMPE Avatar asked Jan 03 '17 13:01

Rodolphe LAMPE


1 Answers

I think you can do this by masking scale_colour_discrete:

scale_colour_discrete <- function(...)  {

    scale_colour_manual(...,values=c("#000000","#111111"))
}
like image 72
Ben Bolker Avatar answered Oct 14 '22 18:10

Ben Bolker