Dot-dash plot in lattice
In this week assignment i was prompt to create a visualization graph using one of Professor
Edward R. Tufte Dot-dash plot in lattice function to compare miles per gallon vs car weight. below is the code and plot graph.
Code:
x <- mtcars$wt
y <- mtcars$mpg
xyplot(y ~ x, xlab="Car weight (lb/1000)", ylab="Miles per gallon of fuel",
+ par.settings = list(axis.line = list(col="transparent")),
+ panel = function(x, y,...) {
+ panel.xyplot(x, y, col=1, pch=16)
+ panel.rug(x, y, col=1, x.units = rep("snpc", 2), y.units = rep("snpc", 2), ...)})
Comments
Post a Comment