[R] [R ]Exporting rgl.snapshot and rgl.postscript
Thanh Tran
m@@ternh@ttt @ending from gm@il@com
Tue Nov 27 13:53:38 CET 2018
Dear all,
I'm trying to plot a surface over the x-y plane. In my data, the response
is KIC, and 4 factors are AC, AV, T, and Temp. I want to have response
surface of KIC with two factors, i.e., AC and AV. A typical second-degree
response modeling is as follows:
> data<-read.csv("2.csv", header =T)
> mod <- lm(KIC~AC+I(AC^2)+AV+I(AV^2)+T+I(T^2)+Temp+I(Temp^2)+AC:AV+AC:T+AC:Temp+AV:T+AV:Temp+T:Temp,
+ data = data)
> library(rgl)
> KIC <- function(AC, AV, Temp, T) predict(mod, newdata = data.frame(AC, AV, Temp, T))
> persp3d(KIC, xlim = c(4, 5), # The range of values for AC
+ ylim = c(4, 7), # The range for AV
+ xlab = "AC", ylab = "AV", zlab = "KIC",
+ col = "lightblue",
+ otherargs = list(Temp = 15, T = 40))
> rgl.snapshot("1.png", fmt = "png", top = TRUE )
> rgl.postscript("1.pdf","pdf")
The problem is that the figure created by *rgl.snapshot* (attached Figure
1) has low quality, while the figure created by *rgl.postscript* (attached
Figure 2) doesn’t have adequate details.
Can somebody please show me how to properly export the file? I would prefer
the Figure have the TIFF or PDF with the resolution 600 dpi. I really
appreciate your support and help.
Best regards,
Nhat Tran
Ps: I also added a CSV file for practicing R.
More information about the R-help
mailing list