###########
##example 1
###########
if (FALSE) {
#plotting pems with other packages
#base
plot(pems.1)
plot(pems.1$velocity)
#with lattice
require(lattice)
xyplot(velocity~local.time, data = pems.1, type = "l")
#with ggplot2
require(ggplot2)
qplot(time.stamp, velocity, data=pems.1)
ggplot(pems.1, aes(x = time.stamp, y = velocity)) + geom_line()
#etc
}
###########
##example 2
###########
#basic usage of latticePlot
latticePlot(velocity~local.time, data = pems.1, type = "l")
latticePlot(velocity~local.time, data = pems.1, col = "red",
pch = 20, panel = panel.PEMSXYPlot,
grid = list(col ="black", lty=2))
###########
##example 3
###########
#basic usage of XYZPlot
a <- calcAccel(velocity, local.time, data = pems.1, output="pems")
XYZPlot(~accel*velocity, data=a)
XYZPlot(~accel*velocity, data=a, plot = lattice::wireframe, shade=TRUE)
###########
##example 4
###########
#basic usage of pemsPlot
pemsPlot(local.time, velocity, data=pems.1, type="l")
###########
##example 5
###########
#basic usage of WatsonPlot
#Note: using 'a' generated in example 3
WatsonPlot(velocity, accel, data=a)
if (FALSE) {
#omit.stopped for different handling of idling data
WatsonPlot(velocity, accel, data=a, omit.stopped="points")
WatsonPlot(velocity, accel, data=a, omit.stopped="cells")
#plot.type for different plot methods
WatsonPlot(velocity, accel, data=a, plot.type=1)
WatsonPlot(velocity, accel, data=a, plot.type=2)
WatsonPlot(velocity, accel, data=a, plot.type=3)
WatsonPlot(velocity, accel, data=a, plot.type=4)
}
Run the code above in your browser using DataLab