Ordering data in R lattice levelplot -
i trying create lattice levelplot , want levels plotted in specific order.
name1 name2 value a 1 b 3 c 2 b 4 b b 1 b c 3 c 1 c b 3 c c 4
so let's want name1 vertically , sorted ascending sum of values name1. how go doing that?
i think i'm getting somewhere - need re-order levels seems. still haven't figured out exact way it.
so managed alter levels - values didn't change! using levels(reorder()). have utilize factor?
it little bit confusing want, guess want levelplot
looks gradient ...
i create z level using cumsum
, ave
dat$o <- ave(dat$value,dat$name1,fun=cumsum)
then
library(latticeextra) levelplot(o~name2+name1,data=dat, panel = panel.levelplot.points,type = c("p", "g"), aspect = "iso", prepanel = prepanel.default.xyplot, cex=10)
r lattice levelplot
No comments:
Post a Comment