Save the orientation of a RGL plot3d() plot

孤街醉人 提交于 2019-11-28 21:05:32

问题


I have a 3D plot using RGL. I would like to make identical plots using color to highlight the distribution of some variable. To do this I would like to have identical plots, how do I find and set the orientation of a plot?

Once I make a preliminary plot, I move it around to find a nice display angle and I would like to save that angle and incorporate it into future plotting scripts. Anyone have a suggestion on how to do this?

library(rgl)
plot3d(iris) 
#play with the plot to find a good angle
#save the angle for future plots

回答1:


Ben's comment basically answers your question; this just applies expand.dots to what he wrote ;)

## In an inital session:

library(rgl)
plot3d(iris) 

## Now move the image around to an orientation you like

## Save RGL parameters to a list object
pp <- par3d(no.readonly=TRUE)

## Save the list to a text file
dput(pp, file="irisView.R", control = "all")

.......

## Then, in a later session, to recreate the plot just as you had it:

library(rgl)
pp <- dget("irisView.R")
plot3d(iris)
par3d(pp)


来源:https://stackoverflow.com/questions/16362381/save-the-orientation-of-a-rgl-plot3d-plot

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!