clubkli - 10 months ago 73

R Question

In

`R`

`b`

`a`

`xyplot`

Is it possible to have on the x-axis the range from 0 to 10 such that both vectors can be plot againt each other? Now the x-axis is going from 1 to 8.

`b <- c(0.5, 0.75, 1, 2.5, 4, 6, 8, 10)`

a <- c(0.0499, 0.0491, 0.0507, 0.0505, 0.0513, 0.0493, 0.0507, 0.0500)

library(lattice)

xyplot(a ~1:8, type="l", col="blue", ylim=c(0,0.10))

Edit:

I mean that we have a plot of a line going through the coordinates (0.5,0.0409); (0.75,0.0491); (1, 0.0507) etc.

Answer

Source (Stackoverflow)