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

Marius Hofert m_hofert at web.de
Fri Mar 11 07:59:36 CET 2011


Dear Deepayan,

many thanks for answering. 

Another thing I am wondering is the following: I know you can have (3d-like) "crosses" in the wireframe plot. But are there any other 3d-like plot symbols? Of course one can use different colors to distinguish between several points. The problem is that most of the scientific journals do not allow colors [or it's expensive]. I am thus wondering if the plot symbols have equivalent 3d-versions. It looks a bit odd to draw a 2d cross in a 3d wireframe. Or a circle. Concerning the circle, it could be a small ball in 3d for example. Is there anything like this?

Cheers,

Marius

On 2011-03-11, at 07:19 , Deepayan Sarkar wrote:

> 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