0
votes

I am trying to add arrows (error bars) to a simple bar plot. The first one works and the last two just bring up loads of error messages even though they are formatted in exactly the same way!

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)

Error in arrows(1.9, 496.4951, 1.9, 496.4951, length = 0.5, angle = 90, : invalid arrow head specification In addition: Warning messages: 1: In doTryCatch(return(expr), name, parentenv, handler) : zero-length arrow is of indeterminate angle and so skipped 2: In doTryCatch(return(expr), name, parentenv, handler) : zero-length arrow is of indeterminate angle and so skipped 3: In doTryCatch(return(expr), name, parentenv, handler) : zero-length arrow is of indeterminate angle and so skipped 4: In doTryCatch(return(expr), name, parentenv, handler) : zero-length arrow is of indeterminate angle and so skipped

This is how the plot turns out

1
Your second error seems to have zero length. - G5W
But what does that mean? - Sabytet

1 Answers

1
votes

Fixed it...

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)