Skip to content
Prev 913 / 29559 Next

Best way to plot cross sections of discrete-valued grids

Waichler, Scott R wrote:
O.K., and you want to plot the different cross sections in a conditioning
levelplot? I would go like this: convert the whole thing to points (well, it
was points in my example), apply a coordinate transformation such that z
is the variable you want to cross sect, and apply

levelplot(v~x+y|z, as.data.frame(pts))

If the cross sections you want already line up with x and y, you can leave
out the coordinate transformation; the transformation makes just any
2D cross section possible. It could however be that some cross sections
don't result in nicely gridded patterns, and might need rotation before
levelplot deals with them the way you want.
--
Edzer