[R] lattice: wireframe "eats up" points; how to make points on wireframe visible?
deepayan.sarkar at gmail.com
Fri Apr 1 13:58:54 CEST 2011
On Thu, Mar 31, 2011 at 3:26 AM, Marius Hofert <m_hofert at web.de> wrote:
> Dear Deepayan,
> thanks for answering. It's never too late to be useful.
> I see your point in the minimal example. I checked the z-axis limits in my
> original problem for the point to be inside and it wasn't there. I can't easily
> reproduce it from the minimal example though. I'll get back to you if I run into
> this problem again.
> In the example below, both points are shown. Although one lies clearly below/under
> the surface, it looks as if it lies above. One would probably have to plot this
> point first so that the wire frame is above the point. But still, this is
> misleading since the eye believes that the wireframe is *not* transparent. This
> happens because the lines connecting (0,1,0)--(1,1,0)--(1,0,0) [dashed ones] are
> not completely visible [also not the one from (1,1,0) to (1,1,1)]. How can I make
> them visible even if they lie behind/under the wireframe? I tried to work with
> col="transparent" and with alpha=... but neither did work as I expected.
> My goal is to make the small "rectangles" between the wire transparent.
> I also use these plots in posters with a certain gradient-like background color
> and so it's a bit annoying that the "rectangles" are filled with white color.
Yes, that probably needs a new argument; the default computation is a
bit of a hack. You can try the following workaround for now:
wireframe(z~x*y, pts=pts, aspect=1, scales=list(col=1, arrows=FALSE),
par.settings = list(background = list(col = "#ffffff11")), ## <- NEW
panel.3d.wireframe = function(x,y,z,xlim,ylim,zlim,xlim.scaled,
panel.3dwire(x=x, y=y, z=z, xlim=xlim, ylim=ylim, zlim=zlim,
panel.3dscatter(x=pts[,1], y=pts[,2], z=pts[,3],
xlim=xlim, ylim=ylim, zlim=zlim,
zlim.scaled=zlim.scaled, type="p", col=c(2,3),
cex=1.8, pch=c(3,4), .scale=TRUE, ...)
col = "#ffffff00" instead will give you full transparency (but
"transparent" will not work), and col = "#ffffff77" will be less
transparent and so on.
More information about the R-help