0

I have no idea why scale_fill_manual isn't working here, while scale_shape_manual and scale_colour_manual does.I've searched but none solved the problem. R code:

    ggplot(Alltable,aes(x=Alltable$feature,
       y=Alltable$data.Nonsynonymous.tumor.mutation.burden,
       fill=Alltable$feature,
       shape=Alltable$feature,colour=Alltable$feature))+
       labs(x='',y='Tumor mutation burden')+
       theme_classic()+
       geom_boxplot(fill="white",color="black",lwd=1)+
       geom_quasirandom(size=1.5,width=0.3,varwidth=T)+
       scale_colour_manual(values=c("CR/PR"<-"blue","SD/PD"<-"red","DCB"<-"green3","NDB"<-"purple"))+
       scale_shape_manual(values=c("CR/PR"=1,"SD/PD"=0,"DCB"=6,"NDB"=5))+
       scale_fill_manual(values=c("CR/PR"<-"blue","SD/PD"<-"red","DCB"<-"green3","NDB"<-"purple"))+
       theme(legend.position="none")
Jane Han
  • 9
  • 1
  • 1
    Please set up a [reproducible example](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example). And `scale_###__manual` usually correspond to the *fill* or *color* or *shape* variable in `aes()`. In your code there is no *color* assignment in `aes()`. – Parfait Oct 29 '18 at 18:03
  • In addition to what you put in your answer, you [pretty much never want to use `$` inside `aes`](https://stackoverflow.com/q/32543340/5325862) – camille Oct 29 '18 at 18:15

1 Answers1

0

I figured out! In scale_shape_manual(values=c("CR/PR"=1,"SD/PD"=0,"DCB"=6,"NDB"=5)),the shapes are hollow. Changing to scale_shape_manual(values=c("CR/PR"=21,"SD/PD"=22,"DCB"=25,"NDB"=23)) will do.

Jane Han
  • 9
  • 1