rgl

5 dimensional plot in r

旧街凉风 提交于 2019-12-02 17:18:19
I am trying to plot a 5 dimensional plot in R. I am currently using the rgl package to plot my data in 4 dimensions, using 3 variables as the x,y,z, coordinates, another variable as the color. I am wondering if I can add a fifth variable using this package, like for example the size or the shape of the points in the space. Here's an example of my data, and my current code: set.seed(1) df <- data.frame(replicate(4,sample(1:200,1000,rep=TRUE))) addme <- data.frame(replicate(1,sample(0:1,1000,rep=TRUE))) df <- cbind(df,addme) colnames(df) <- c("var1","var2","var3","var4","var5") require(rgl)

Overlay a map on top of a 3d surface map in r

╄→гoц情女王★ 提交于 2019-12-02 16:57:20
I have created a 3d map using rgl.surface(), mainly following Shane's answer in this post. Using my own data, I get this map On top of this surface map, I would like to add a map of vegetation density such that I obtain something like this (obtained with the software Surfer): Is it possible to do this with rgl, or for that matter any other package in r or is the only solution to have two maps like in Shane's answer? Thank you. Edit: Following @gsk3's request, here is the code for this map: library(rgl) # Read the z (i.e. elevation) dimension from file z1 = matrix(scan("myfile.txt"),nrow=256,

rgl.snapshot() No Longer Works

感情迁移 提交于 2019-12-02 09:07:55
问题 I just upgraded R and rgl to the following versions. Now, rgl.snapshot() no longer works. It worked in previous versions. Is there a way around this? R version 2.12.1 (2010-12-16) rgl version 0.92.798 > library(rgl) > x<-rnorm(100) > y<-rnorm(100) > z<-rnorm(100) > r<-0.2 > p <- plot3d(x, y, z, axes=FALSE, box=FALSE, radius=r, type='s', + xlab="", ylab="", zlab="", col=rainbow(100)) > rgl.snapshot("C:\\Temp\\pic.png", fmt="png", top=TRUE ) Error in rgl.snapshot("C:\\Temp\\pic.png") : pixmap

rgl.snapshot() No Longer Works

大城市里の小女人 提交于 2019-12-02 03:53:21
I just upgraded R and rgl to the following versions. Now, rgl.snapshot() no longer works. It worked in previous versions. Is there a way around this? R version 2.12.1 (2010-12-16) rgl version 0.92.798 > library(rgl) > x<-rnorm(100) > y<-rnorm(100) > z<-rnorm(100) > r<-0.2 > p <- plot3d(x, y, z, axes=FALSE, box=FALSE, radius=r, type='s', + xlab="", ylab="", zlab="", col=rainbow(100)) > rgl.snapshot("C:\\Temp\\pic.png", fmt="png", top=TRUE ) Error in rgl.snapshot("C:\\Temp\\pic.png") : pixmap save format not supported in this build That build doesn't have PNG support (yet). You can use

Rottation of R 3d plots not working properly with knitr and webgl

假如想象 提交于 2019-12-01 22:20:42
问题 I am trying to use rgl knitr and webgl to plot several interactive 3d plots in a sequence. And I am getting quite a weird behavior: when trying to rotate the plots with a mouse they seem to get back to their initial position after each mouse drag. This makes the interaction quite unintuitive. I noticed that the last plot on a page is not affected by this, but all the rest are. This can be seen on the original knitr example: source: https://dl.dropboxusercontent.com/u/15335397/misc/webgl-rmd

Shiny RGL Plot3D: Keep Plot View Orientation On Replot

我怕爱的太早我们不能终老 提交于 2019-12-01 18:09:56
Whenever I do a re-plot on a RGL plot3D it causes the view orientation of the plot to be reset to it's default. Does anyone know how to save these settings so that I can reapply them after a plot is redrawn. I tried this : # save settings pp <- par3d(no.readonly=TRUE) # initialize plot plot3d(c(), c(), c(), "", "", "") # Replot data here # ... # restore settings par3d(pp) However, this did not restore the plot orientation. EDIT: printing out the result of par3d() shows that the values are not getting updated as the plot is rotated and zoomed, so I'm guessing this is the issue. It might be an

Shiny RGL Plot3D: Keep Plot View Orientation On Replot

邮差的信 提交于 2019-12-01 16:38:33
问题 Whenever I do a re-plot on a RGL plot3D it causes the view orientation of the plot to be reset to it's default. Does anyone know how to save these settings so that I can reapply them after a plot is redrawn. I tried this: # save settings pp <- par3d(no.readonly=TRUE) # initialize plot plot3d(c(), c(), c(), "", "", "") # Replot data here # ... # restore settings par3d(pp) However, this did not restore the plot orientation. EDIT: printing out the result of par3d() shows that the values are not

Put a fixed title in an interactive 3D plot using rgl package, R

二次信任 提交于 2019-12-01 14:55:22
问题 I am trying to add a fixed title to an interactive 3d plot using the rgl package from R, but so far I haven't been able to do it. I also would like to have one main title and a subtitle under the main title. Here is a sample code, library(rgl) data<-read.table(text=" X Y Z 1 147.0883 -18.69122 -13.90000 2 147.0894 -18.69455 -10.97250 3 147.0883 -18.69122 -17.45000 4 147.0883 -18.69122 -15.44000 5 147.0883 -18.69122 -13.45000 6 147.0909 -18.69922 -12.25000 7 147.0883 -18.69122 -17.30000 8 147

plot3d - how to change box color and remove axis ticks

感情迁移 提交于 2019-12-01 08:55:25
I'm trying to make some visual modifications to the default plot3d object. Specifically i would like to put a light box color as a background (only in the box, not the whole palette) and remove the axis tick marks (the x,y,z values on the axis are distracting). I have spent countless hours googling what options to change, but I cannot for the life of me figure this out. Any help would be super appreciated. I whittled down my code to the following, so that you can re-produce it. library(rgl) xvar <- c(0.23158792, 0.09686823, -0.58937138, -1.04380419,0.52169760, 1.15218492, 1.36873947, -0

plot3d - how to change box color and remove axis ticks

五迷三道 提交于 2019-12-01 07:41:08
问题 I'm trying to make some visual modifications to the default plot3d object. Specifically i would like to put a light box color as a background (only in the box, not the whole palette) and remove the axis tick marks (the x,y,z values on the axis are distracting). I have spent countless hours googling what options to change, but I cannot for the life of me figure this out. Any help would be super appreciated. I whittled down my code to the following, so that you can re-produce it. library(rgl)