Error in `geom_point()`:

Hi, can somebody help me with this error?
BP1=ggplot(BP, aes(x=RF , y=Term)) +geom_point(aes(colours=P-value , size=Genes)) +scale_colour_gradientn(colours=rainbow(5)) +labs(x='Rich Factor' , y=NULL , colour='P-value' , size='Genes')+
theme(axis.title=element_text(face='bold') , axis.text = element_text(face='bold'))
pdf("BP.pdf") ; BP1;

Error in geom_point():
! Problem while computing aesthetics.
:information_source: Error occurred in the 1st layer.
Caused by error in FUN():

First, change the aesthetic from colours to colour. Does that help

tnx, I changed that, it doesn't work..

that was good advice, because only color and colour are aesthetics and colors/colours (plural) are not.
aside from that you have a variable called P-value this will confuse R into thinking you have a variable called P and one called value and you want to subtract them ...

  1. rename your variables in an earlier step , something like p_value would be good
  2. if you need to refer to it with its current name use a pair of backticks to quote it so R knows its one symbol, like this
1 Like

Thank you very much.
I replaced it with 'P.value' and it works...
I greatly appreciate your advice.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.