Questions tagged [rgl]

`rgl` is a 3D visualization device system for R, using OpenGL as the rendering backend.

The rgl package is a 3D visualization device system for R based on OpenGL. An rgl device at its core is a real-time 3D engine written in C++. It provides an interactive viewpoint navigation facility (mouse + wheel support) and an R programming interface.

Features:

  • Cross-platform (Mac OS X, Win32, Unix/X11)
  • R programming interface
  • Interactive viewpoint navigation
  • Automatic data focus Geometry primitives: points, lines, triangles, quads, texts, spheres, 3D sprites, particles, terrain
  • Up to eight light sources
  • Alpha-blending (transparency)
  • Side-dependant rendering
  • Texture-mapping with mipmap support
  • Environmental effects: fogging, background sphere
  • Bounding box with axis ticks marks
  • Undo operation

Resources:

470 questions
58
votes
1 answer

Animated rgl graphs with knitr

I want to include animated rgl graphs in my .Rnw document through knitr. Here is my MWE: \documentclass{article} << label = setup, include = FALSE>>= opts_chunk$set(fig.path = 'figure/', cache = FALSE, dev = "pdf", fig.align = 'center', fig.show…
MYaseen208
  • 19,213
  • 32
  • 133
  • 260
55
votes
7 answers

Installing rgl on Ubuntu and Mac: X11 not found

I have seen this question here: Error in loading rgl package with Mac OS X but there is no mentioning about installation error, which is my case. I cannot install rgl package, using this command in…
Matin Kh
  • 4,912
  • 6
  • 44
  • 74
42
votes
3 answers

3d surface plot with xyz coordinates

I am hoping someone with experience can help in how one prepares the shape files from xyz data. A great example of a well-prepared dataset can be seen here for the comet Churyumov–Gerasimenko, although the preceding steps in creating the shape file…
Marc in the box
  • 10,579
  • 4
  • 40
  • 87
41
votes
1 answer

including a interactive 3D figure with knitr

Using knitr it is possible to embed a rgl 3D graphics in a html document from a Rmarkdown source file: ```{r setup} library(rgl) knit_hooks$set(rgl = hook_rgl) x <- sort(rnorm(1000)) y <- rnorm(1000) z <- rnorm(1000) + atan2(x,y) ``` ```{r,…
Stéphane Laurent
  • 48,421
  • 14
  • 86
  • 170
34
votes
5 answers

R: Plotting a 3D surface from x, y, z

imagine I have a 3 columns matrix x, y, z where z is a function of x and y. I know how to plot a "scatter plot" of these points with plot3d(x,y,z) But if I want a surface instead I must use other commands such as surface3d The problem is that it…
skan
  • 6,456
  • 11
  • 47
  • 83
26
votes
1 answer

Save the orientation of a RGL plot3d() plot

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…
zach
  • 22,141
  • 16
  • 57
  • 86
24
votes
6 answers

R: using rgl to generate 3d rotatable plots that can be viewed in a web browser?

In the world of the R statistics package, rgl allows me to generate 3d plots that I can rotate with my mouse. Is there a way I can export these plots in a portable format, load them in a web browser or other third party tool and rotate them there? …
Setjmp
  • 23,834
  • 23
  • 67
  • 90
23
votes
1 answer

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

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…
SnowFrog
  • 1,122
  • 2
  • 17
  • 38
21
votes
6 answers

Error in loading rgl package with Mac OS X

I am trying to install rgl package (0.92.858) for R (2.14.2) under Mac OS X (Lion 10.7.3). When I try to load it (library(rgl)), I get the following error: Error : .onLoad failed in loadNamespace() for 'rgl', details: call: dyn.load(file,…
Mikko
  • 6,175
  • 6
  • 40
  • 82
20
votes
2 answers

Get rgl view parameters

While the view3d(theta, phi,...) function can be used to rotate the viewing point to a suitable location while taking snapshot of 3d charts/objects, it's quite hard to guess which theta and phi values are good. Once the plot is shown, we can…
Ali
  • 8,590
  • 11
  • 55
  • 86
13
votes
1 answer

5 dimensional plot in r

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…
Error404
  • 6,329
  • 13
  • 43
  • 57
12
votes
4 answers

Installing "rgl" package in R, Mac OSX El Captian

I'm new to programming in R so I apologise in advance if I seem naive. I want to be able to do some principal components analysis on my data in 3D. I read that the "pca3d" function is good for this, but I need to download the "rgl" library. When I…
Claire
  • 301
  • 1
  • 2
  • 9
12
votes
3 answers

plot3d - having two plots at once

plot3d() produces a 3d plot that I can twist around and rotate. But when I call plot3d() again, the previous plot goes away and is replaced by this one. How can I make it so that a new XQuartz window opens up rather than the old window being…
CodeGuy
  • 26,751
  • 71
  • 191
  • 310
11
votes
2 answers

Saving rgl 3D scene to u3d (for .pdf integration)

I have a 3D scene generated with the R rgl package. I can save it in RTL and OBJ format via the rgl functions, but these functions don't support colors. I can save it in WebGL, but then I can't find a WebGL to .u3d converter, nor any way to insert…
AF7
  • 2,561
  • 20
  • 51
11
votes
1 answer

Complete missing lines using rgl grid3d

Does anyone know of a way to 1) complete the missing gridlines in the grid3d call for y, and 2) draw horizontal gridlines to close the top of the grids constructed by the grid3d calls for x and y? I've played around with various combinations of…
Pat W.
  • 1,641
  • 2
  • 22
  • 35
1
2 3
31 32