Plot a line graph, error in xy.coords(x, y, xlabel, ylabel, log) : ‘x’ and ‘y’ lengths differ

a<- c(2,2)
b<- c(3,4)
plot(a,b) # It works perfectly here

Then I tried:

t<-xy.coords(a,b)
plot(t) # It also works well here

Finally, I tried:

plot(t,1)

Now it shows me:

Error in xy.coords(x, y, xlabel, ylabel, log) : ‘x’ and ‘y’ lengths differ

It does not work, inside t, both a and b are of length 2, why it showing me x, y lengths differ?

Leave a Comment

error code: 523