Hi Duncan Murdoch Thank you for your support. Best regards, Nhat Tran Vào Th 3, 27 thg 11, 2018 vào lúc 23:06 Duncan Murdoch < murdoch.dun...@gmail.com> đã viết:
> On 27/11/2018 7:53 AM, Thanh Tran wrote: > > 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. > > You can improve the rgl.snapshot output by starting from a large window. > You can do this either by using the mouse to enlarge the window, or > specifying values for windowRect in par3d() or open3d(), e.g. > > open3d(windowRect=c(0,0, 1800, 1800)) > > Whether very large values will be respected depends on the system. For > example, my Macbook Air reduces that request so the whole window is > visible, > > > par3d("windowRect") > [1] 0 45 1440 901 > > You can set the default to be a large window using > > r3dDefaults <- getr3dDefaults() > r3dDefaults$windowRect <- c(0,0, 1800, 1800) > > (This will only be respected by the *3d functions like open3d(), not the > low-level rgl.* functions like rgl.open().) > > The rgl.postscript() display is limited by what the GL2PS library can > do, so if it doesn't do what you want, there's not much you can do to > improve it. > > Duncan Murdoch > > > > > > > > > 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. > > ______________________________________________ > > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > > 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. > > > > [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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.