Hi all,
I'm trying to add error bars to an existing line graph in base R.
The basic line graph comes up just fine, but it does not show my error bars...
Here is the code..
SCAPHLINEGRAPHNEW <- interaction.plot(readscaphfileNEW$TEMP, readscaphfileNEW$EXPERIMENT, readscaphfileNEW$SCAPH.BPM,
xlab = "Temperature (°C)", ylab = "Scaphognathite Rate (BPM)",
main = "Scaphognathite",
ylim = c(0,300), trace.label = "Year",
type = "b", pch = c(19,17), fixed = TRUE)
arrows(SCAPHLINEGRAPHNEW,ScaphmeansNEW+seNEWSCAPH,SCAPHLINEGRAPHNEW,ScaphmeansNEW-seNEWSCAPH,code=3, angle=90, length=0.1)
Error in arrows(SCAPHLINEGRAPHNEW, ScaphmeansNEW + seNEWSCAPH, SCAPHLINEGRAPHNEW, : invalid graphics state
Why are my error bars not showing? Is the 'arrows' line wrong?
Thanks a million for your help, everybody.
Here is my data...
> dput(readscaphfileNEW)
structure(list(EXPERIMENT = c("2021", "2021", "2021", "2021",
"2021", "2021", "2021", "2021", "2021", "2021", "2021", "2021",
"2021", "2021", "2021", "2021", "2021", "2021", "2021", "1939",
"1939", "1939", "1939", "1939", "1939", "1939", "1939", "1939",
"1939", "1939", "1939", "1939", "1939", "1939", "1939", "1939",
"1939", "1939"), TEMP = c(12L, 12L, 12L, 12L, 12L, 12L, 12L,
12L, 12L, 17L, 17L, 17L, 17L, 17L, 17L, 17L, 17L, 17L, 17L, 12L,
12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L, 17L, 17L, 17L, 17L, 17L,
17L, 17L, 17L, 17L, 17L), SCAPH.BPM = c(82, 58, 78, 59, 80, 100,
61, 103, 61, 100, 70, 83, 73, 143, 103, 73, 158, 95, 80, 158,
148, 152, 148, 160, 168, 152, 150, 187, 300, 302, 291, 240, 253,
207, 184, 224, 242, 236)), row.names = c(NA, -38L), class = "data.frame")
- Bruno