Don't know how to automatically pick scale for object of type data.frame. Defaulting to continuous. ERROR: Aesthetics must be either length 1 or the same as the data (13): size, colour and y

x<-read.csv(file.choose(),stringsAsFactors = F)

x<-x[x$PValue<0.05,]

x_go=x[,1:5]

xbp=x_go[grep("BP",x_go$category),]

xcc=x_go[grep("CC",x_go$category),]

xmf=x_go[grep("MF",x_go$category),]

xkegg=x_go[grep("KEGG",x_go$category),]

xbp$Term=gsub(".*\\~","",xbp$Term)

xcc$Term=gsub(".*\\~","",xcc$Term)

xmf$Term=gsub(".*\\~","",xmf$Term)

xkegg$Term=gsub(".*\\~","",xkegg$Term)

install.packages("ggplot2")

library(ggplot2)

make_GO_bubble<-function(go_data,term_name){

GO_DATA=go_data[order(go_data$Count,decreasing = T),]

GO_DATA=head(GO_DATA,10)

p=ggplot(GO_DATA,aes(x,Term))

bubble=p+geom_point(aes(size=Count,color=-log10(PValue)))

bubble=bubble+scale_colour_gradient(low="green",high="red")

pr=bubble+theme_test(base_size = 16,base_rect_size = 1)

pr=pr+labs("x"="Rich factor",y=term_name,title="Enrichment")

return(pr)

}

make_GO_bubble(xbp,term_name="Biological Process")

I used this command lines to analysis the GO enrichment and KEGG analysis. However , in Rstudio it shows Don't know how to automatically pick scale for object of type data.frame. Defaulting to continuous. ERROR: Aesthetics must be either length 1 or the same as the data (13): size, colour and y. How could I solve this problem?

Hi!

To help us help you, could you please prepare a reproducible example (reprex) illustrating your issue? Please have a look at this guide, to see how to create one:

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.