R plot lines not showing correctly

913 Views Asked by At

I'm trying to create a line graph using data from different columns in the same data frame. I can create the initial plot but when I go to add lines(), lines are not showing correctly (strange straight lines appear and colors are not working).

my data frame is like that:

    GEN   NE   LWR  UPR        color 
1    0   549  134  5600  chartreuse3 
2    1   447  128  3840  chartreuse3 
3    2   361  140  2720  chartreuse3

and my script:

data = read.table(file, as.is = T, col.names=c("GEN","NE","LWR","UPR","color"))
x=data$GEN
y=data$NE
U=data$UPR
L=data$LWR
plotCI(x, y, xlim=c(0,70), pch=20, ui=U, li=L, log="y",
       col=as.character(data$color), barcol=as.character(data$color),
       lwd=0.1, lty=2, gap=2)
lines(x, y,lwd = 1,col=as.character(data$color))

Plot with lines

Thank you in advance for your help! (I'm sure it's a foolish question..)

0

There are 0 best solutions below