[R] lattice (panel.3dscatter): how to make plot symbol thicker?

Deepayan Sarkar deepayan.sarkar at gmail.com
Fri Mar 11 07:19:11 CET 2011


On Wed, Mar 9, 2011 at 7:57 AM, Peter Ehlers <ehlers at ucalgary.ca> wrote:
> On 2011-03-08 17:07, Jannis wrote:
>>
>> Searching the archive of the mailing list points to the following thread:
>>
>> https://stat.ethz.ch/pipermail/r-help/2009-March/193338.html
>>
>> Perhaps it helps you...
>>
>> On 03/08/2011 11:48 PM, Marius Hofert wrote:
>>>
>>> Dear expeRts,
>>>
>>> I would like to make a plot symbol in panel.3dscatter thicker. As you can
>>> see from
>>> the minimal example below, the parameter "lwd" does not solve this
>>> problem.
>>> What can I do to make the plot symbol thicker?
>>>
>>> Cheers,
>>>
>>> Marius
>>>
>>>
>>>
>>> library(lattice)
>>>
>>> x<- 1:10
>>> y<- x
>>> g<- expand.grid(x=x, y=y)
>>> z<- apply(g, 1, function(z) log(z[1] + z[2]^2))
>>> val<- cbind(g, z)
>>> pts<- c(3,5,3.34)
>>>
>>> wireframe(val[,3] ~ val[,1]*val[,2], pts=pts, xlab="x", ylab="y",
>>> zlab="z",
>>>            panel.3d.wireframe =
>>> function(x,y,z,xlim,ylim,zlim,xlim.scaled,
>>>            ylim.scaled,zlim.scaled,pts,...){
>>>                panel.3dwire(x=x, y=y, z=z, xlim=xlim, ylim=ylim,
>>> zlim=zlim,
>>>                             xlim.scaled=xlim.scaled,
>>> ylim.scaled=ylim.scaled,
>>>                             zlim.scaled=zlim.scaled, ...)
>>>                panel.3dscatter(x=pts[1], y=pts[2], z=pts[3],
>>>                                xlim=xlim, ylim=ylim, zlim=zlim,
>>>                                xlim.scaled=xlim.scaled,
>>> ylim.scaled=ylim.scaled,
>>>                                zlim.scaled=zlim.scaled, type="p",
>>>                                pch=3, lwd=10, cex=3, .scale=TRUE, ...)
>>>            })
>>>
>
> Marius,
>
> Jannis's reference is good, but wireframe needs a bit more
> tweaking than xyplot. You need to edit panel.3dscatter (very
> slightly). Find this code:
>
>  lpoints(x = m[1, ord], y = m[2, ord], col = col.point[ord],
>     pch = pch[ord], cex = cex[ord])
>
> and modify it to:
>
>  lpoints(x = m[1, ord], y = m[2, ord], col = col.point[ord],
>     pch = pch[ord], cex = cex[ord], ...)
>
> Save the modified code as mypanel.3dscatter and set its environment
> with
>
>  environment(mypanel.3dscatter) <- environment(panel.3dscatter)
>
> Then replace panel.3dscatter with mypanel.3dscatter in your
> code and replace your 'lwd=10' with 'lex=10'.
>
> If Deepayan is reading this and doesn't have a better idea, he
> might perhaps make the change permanent.

I will. (Just wondering why it wasn't so already, hopefully just an oversight.)

-Deepayan

>
> Peter Ehlers



More information about the R-help mailing list