R语言小白,网上搜了一份代码,修改后最后一步如下报错,应该怎么修改代码,望大佬们帮忙指导!
``` setwd("F:/Research/gse27447/DAVID")
> library(ggplot2)
> pathway = read.csv("KEGG2.csv",header=TRUE,row.names=1,check.names = FALSE)
> p = ggplot(pathway,aes(Pvalue,pathway))
> p=p + geom_point()
> # 修稿点的大小
> p=p + geom_point(aes(size=Count))
> # 展示三维数据
> pbubble = p+ geom_point(aes(size=Count,color=-1*log10(Pvalue)))
> # 设置渐变色
> pr = pbubble+scale_color_gradient(low="green",high = "red")
> # 绘制p气泡图
> pr = pr+labs(color=expression(-log[10](Pvalue)),size="Count",
+ x="Pvalue",y="Pathway name",title="Pathway enrichment")
> pr + theme_bw()
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): y
Run `rlang::last_error()` to see where the error occurred.
> ## 保存图片
> ggsave("out.pdf")# 保存为pdf格式
Saving 7.64 x 5.6 in image
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): y
Run `rlang::last_error()` to see where the error occurred.
> ggsave("out2.png",width=4,height=4)# 设定画布大小
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): y
Run `rlang::last_error()` to see where the error occurred.