Gregory.Y 2020-07-23 20:01 采纳率: 0%
浏览 1442
已结题

R语言小白,做KEGG气泡图出现报错Don't know how to automatically pick scale for object of type data.frame,该如何解决?

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.
  • 写回答

1条回答 默认 最新

  • dabocaiqq 2020-07-25 14:38
    关注
    评论

报告相同问题?

悬赏问题

  • ¥15 安卓adb backup备份应用数据失败
  • ¥15 eclipse运行项目时遇到的问题
  • ¥15 关于#c##的问题:最近需要用CAT工具Trados进行一些开发
  • ¥15 南大pa1 小游戏没有界面,并且报了如下错误,尝试过换显卡驱动,但是好像不行
  • ¥15 没有证书,nginx怎么反向代理到只能接受https的公网网站
  • ¥50 成都蓉城足球俱乐部小程序抢票
  • ¥15 yolov7训练自己的数据集
  • ¥15 esp8266与51单片机连接问题(标签-单片机|关键词-串口)(相关搜索:51单片机|单片机|测试代码)
  • ¥15 电力市场出清matlab yalmip kkt 双层优化问题
  • ¥30 ros小车路径规划实现不了,如何解决?(操作系统-ubuntu)