Setting color palette in R -


i have been trying produce plot in grayscale confidence interval fill , black lines predicted lines. have tried every lead find online , far has not produced plot in grayscale. obliged help.

for reference, predictor 1 categorical variable (3 levels) , predictor 2 continuous predictor variable.

library(ggthemes) ggplot() + geom_ribbon(data=yhat, aes(x=predictor2, ymax=fit+se*1.96,  ymin=fit-se*1.96, fill=predictor1), alpha=0.5)+ geom_line(data=yhat, aes(predictor2, fit, color=predictor1), size=1.5) +xlab('') + ylab('') + ggtitle('')+ theme_few(base_size=14)+ scale_y_continuous(limits=c(0,1))+ geom_abline(aes(intercept=0.5,slope=0),linetype="dashed") 

you can create own pallette ggplot

pallette_yellow_green <- c("#ffff00", "#d4e100", "#bfd300", "#95b500", "#80a600", "#6a9700", "#558800", "#2b6b00", "#155c00", "#003400") 

and

 ggplot()+scale_fill_manual(values = pallette_yellow_green) 

how find color codes? use example http://www.colorhexa.com/ (go gradient generator)

that settles issue discrete variable

for continuous variables scale_fill_continuous or scale_fill_gradient should set up: http://docs.ggplot2.org/0.9.3.1/scale_gradient.html


Comments

Popular posts from this blog

twig - Using Twigbridge in a Laravel 5.1 Package -

jdbc - Not able to establish database connection in eclipse -

Kivy: Swiping (Carousel & ScreenManager) -