[R] rgl.postscript generating pdf: floating xlab, font size, transparency

Kim Milferstedt milferst at uiuc.edu
Wed Apr 4 19:17:14 CEST 2007


Hello,

I very much enjoy rgl! But when converting the screen output to pdf 
using rgl.postscript I have encountered three problems:

(1) I don't seem to have control over font sizes and point sizes (of 
added points) in the pdf output. I tried cex from "plot" but that 
does not have an effect. Initially I got some plots where fonts and 
especially points were far too small. But now I cannot reproduce this 
any more and fonts and axis are way too thick. How do you control 
font size, point size etc in the pdf output of rgl.postscript?
(2) I could not figure out if it is possible to prevent the 
expressions entered for xlab, ylab and zlab to float around in the 
plot. I would like them aligned with the labeled axis if that's 
possible. Can I do that with rgl?
(3) I would also like to add a transparent sphere to some plots. I 
did this by adding the next two lines to a plot. However, by adding 
rgl.material(), also my next plots have the new updated properties I 
only intended for the sphere. How can I re-set the rgl.material to 
their defaults or how can I assign properties only for one object?

rgl.material(alpha  = 0.2 )
     spheres3d(0,0,0,1, col= "yellow")

I am working under Win XP with R 2.4.1 and the most current version of rgl.

Thanks,

Kim

## Generating data-set
X <- c(1:6)
endpoint <- 4
interval <- 1
data.length <- 1200
data.rep <- 10

R <- rep(seq(1,endpoint, by =interval),rep((data.length/3)/endpoint,endpoint))
Q <- cbind(matrix(sample(X,data.length , replace = T), ncol = 3, byrow = T),R)

## plotting using rgl
symbol.col   <-  c("blue", "orange", "gold", "indianred")
plot.lim  <- c(1, 6)
plot3d( 0,
         0,
         0,
         xlim = plot.lim,
         ylim = plot.lim,
         zlim = plot.lim,
         type = "n",
         xlab = "X-Axis",
         ylab = "Y-Axis",
         zlab = "Z-Axis",
         )
for (l in 1:endpoint)
         {
                 points3d(   Q[,1][Q[,4] == l],
                             Q[,2][Q[,4] == l],
                             Q[,3][Q[,4] == l],
                 col = symbol.col[l],
                 size = 6)
         }

rgl.postscript("D:/Kim/070402/test4.pdf", fmt="pdf" )

__________________________________________

Kim Milferstedt
University of Illinois at Urbana-Champaign
Department of Civil and Environmental Engineering
4125 Newmark Civil Engineering Laboratory
205 North Mathews Avenue MC-250
Urbana, IL 61801
USA
phone: (001) 217 333-9663
fax: (001) 217 333-6968
email: milferst at uiuc.edu
http://cee.uiuc.edu/research/morgenroth



More information about the R-help mailing list