[R] Surface plot - 3d

Uwe Ligges ligges at statistik.uni-dortmund.de
Mon Mar 20 16:28:13 CET 2006


Cashorali, Tanya wrote:

> Hi, trying this again - any help would be great!
> 
> Basically, I have two matrices of equal dimension, one of them should
> produce something similar to a heatmap.. The 2nd matrix should be the
> "heights" for each value on the heatmap - producing a sort of 3d surface
> plot.
> 
> Viewing this seems like a problem too, as I need to scale the x axis so
> that ~140 labels are visible. 
> 
> I've tried wireframe(), persp(), heatmap(), and the basic graphing
> functions.


So try

  g <- expand.grid(x = 1:145, y = 1:145, gr = 1:2)
  g$z <- log((g$x^g$g + g$y^2) * g$gr)

  pdf("test.pdf", width=25, height=25, paper="special")
  wireframe(z ~ x * y, data = g, groups = gr,
            scales = list(arrows = FALSE, at=1:145, cex=0.2))
  dev.off()

open the pdf file and zoooooooooom in.

Uwe Ligges




> Thank you!!
> ~Tanya
> 
> -----Original Message-----
> From: Uwe Ligges [mailto:ligges at statistik.uni-dortmund.de]
> Sent: Tuesday, March 14, 2006 3:22 AM
> To: Cashorali, Tanya
> Cc: r-help at stat.math.ethz.ch
> Subject: Re: [R] Wireframe axis labels
> 
> Cashorali, Tanya wrote:
> 
> 
>>Hi,
>>I'm trying to do a surface plot using the wireframe function.
>>Everything is working beautifully except that I want to be able to 
>>re-scale it a LOT so that I can fit ~145 labels on the x-axis or
> 
> y-axis.
> 
>>I've tried using zoom, scales, aspect, .. nothing seems to work.  The 
>>help on wireframe in R says that you can input a list of labels for 
>>any of the axes, but this has also failed.
> 
> 
> 
> Hmmmm, you can do so, but I do not believe you really want 145
> labels....:
> 
> 
> g <- expand.grid(x = 1:145, y = 1:145, gr = 1:2) g$z <- log((g$x^g$g +
> g$y^2) * g$gr)
> 
> wireframe(z ~ x * y, data = g, groups = gr,
>            scales = list(arrows = FALSE, at=1:145))

> Uwe Ligges
> 
> 
>>Thanks for any help!
>>-Tanya
>>
>>	[[alternative HTML version deleted]]
>>
>>______________________________________________
>>R-help at stat.math.ethz.ch mailing list
>>https://stat.ethz.ch/mailman/listinfo/r-help
>>PLEASE do read the posting guide! 
>>http://www.R-project.org/posting-guide.html
> 
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide!
> http://www.R-project.org/posting-guide.html
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html




More information about the R-help mailing list