clubkli clubkli - 1 year ago 107
R Question

Values on x-axis in xyplot() in R


I want to plot the values from vector
against vector
(both of length 8) using

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)
xyplot(a ~1:8, type="l", col="blue", ylim=c(0,0.10))


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

If you want to plot the components against each other, just

xyplot(a~b, type="l", col="blue", ylim=c(0,0.1))

enter image description here

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download