Reputation: 12363
I have data in a file, they look this way :
frame_delay
0.000030
0.000028
0.000028
0.000028
0.000028
0.000028
0.000027
0.000027
0.000027
0.000027
0.000028
0.000027
....
I wrote this R
script
delays <- read.table("../../data/frame_delay.dat", header=T)
plot(delays)
And get the following chart.
I wonder how to tune my code to get something more readable like this (forget about lines) where y-axis represent above values and x-axis any sequence of number from 1 to whatever.
Thanks for any reply !
Upvotes: 1
Views: 2749
Reputation: 4760
Try this:
delays <- read.table("../../data/frame_delay.dat", header=T)
plot(row(delays), delays[, 1], type="l")
Upvotes: 2
Reputation: 42649
Give it an artificial X-axis, such as this (naming your data frame x
):
plot(cbind(1:length(x[[1]]), x), xlab='Index')
This does the same thing, perhaps a bit more efficiently:
plot(1:length(x[[1]]),x[[1]], xlab='Index')
Upvotes: 0