首页 > 解决方案 > 向条形图添加箭头时遇到问题

问题描述

我正在尝试将箭头(误差线)添加到简单的条形图中。第一个有效,最后两个只是带来大量错误消息,即使它们的格式完全相同!

secondtimes<-c(568.4667,604.2,585.8)
xabels<-c("1","2","3")
secondplot<-barplot(secondtimes,xlab = "Treatment",ylab = "Time taken / secs",ylim = c(0,800))
axis(1,at=secondplot,labels=xabels)  
arrows(0.7, 522.3074, 0.7, 614.6259, length=0.05, angle=90, code=3)
arrows(1.9, 496.4951, 1.9, 496.4951, length=0.05, angle=90, code=3)
arrows(3.1, 482,3277,3.1, 689.2723, length=0.05, angle=90, code=3)

箭头错误(1.9、496.4951、1.9、496.4951、长度 = 0.5、角度 = 90、:无效的箭头规格另外:警告消息:1:在 doTryCatch(return(expr)、name、parentenv、handler)中:零-长度箭头的角度不确定,因此被跳过 2:在 doTryCatch(return(expr), name, parentenv, handler) 中:零长度箭头的角度不确定,因此被跳过 3:在 doTryCatch(return(expr), name, parentenv , handler) :零长度箭头的角度不确定,因此被跳过 4:在 doTryCatch(return(expr), name, parentenv, handler) 中:零长度箭头的角度不确定,因此被跳过

剧情是这样的

标签: r

解决方案


解决它...

secondtimes<-c(568.4667,604.2,585.8)
xabels<-c("1","2","3")
secondplot<-barplot(secondtimes,xlab = "Treatment",ylab = "Time taken / secs",ylim = c(0,800))
axis(1,at=secondplot,labels=xabels)  
arrows(0.7, 522.3074, 0.7, 614.6259, length=0.05, angle=90, code=3)
arrows(1.9, 496.4951, 1.9, 711.9049, length=0.05, angle=90, code=3)
arrows(3.1, 482.3277,3.1, 689.2723, length=0.05, angle=90, code=3)

推荐阅读