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

From: Peter Ehlers <ehlers_at_ucalgary.ca>
Date: Tue, 08 Mar 2011 18:27:45 -0800

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.

Peter Ehlers



R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Wed 09 Mar 2011 - 02:31:54 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Fri 11 Mar 2011 - 06:40:21 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive