How do I clip a wireframe plot in the z direction?

Clash Royale CLAN TAG#URR8PPPHow do I clip a wireframe plot in the z direction?
How do I clip/crop a wireframe plot at the maximum value of the z axis? For example:
library(lattice)
xy = expand.grid(x=1:5, y=1:5)
z = xy$x * xy$y
plot(wireframe(z ~ xy$x * xy$y, zlim=c(0,7), xlab="x", ylab="y", zlab="x*y",
scales=list(x=list(arrows=FALSE),y=list(arrows=FALSE),
z=list(arrows=FALSE,tick.number=5))))
zlim[2] == 7, so I'd like the plot to be clipped at 7 on the z-axis. But this is what gets plotted:
zlim[2] == 7

It appears that all grid points that connect to a point under the zlim get plotted and all other grid points above zlim get discarded.
I'd like the plot to have all edges cropped at the point that they cross the zlim, i.e., something like this:

Any suggestions are much appreciated.
Thanks,
John
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.