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:

558 questions
6
votes
5 answers

How can I add rows to an R data frame every other row?

Brief: how can I add m rows to my m X n data frame, where each new row is inserted after each existing row? I will essentially copy the existing row, but make a change to one variable. More detail: in reference to another question, I think I can do…
a different ben
  • 3,900
  • 6
  • 35
  • 45
6
votes
2 answers

3d scatterplot in R using rgl plot3d - different size for each data point?

I am using plot3d(x,y,z, col=test$color, size=4) to plot a 3d scatterplot of my dataset with R, but with rgl the size argument only takes one size. Is it possible to have different sizes for each data point, perhaps with another library, or is…
Jack Smith
  • 413
  • 1
  • 5
  • 14
5
votes
1 answer

Colouring brain surface with heat map

library(rgl) library(brainR) template <- readNIfTI(system.file("MNI152_T1_2mm_brain.nii.gz", package = "brainR"), reorient = FALSE) misc3d::contour3d(template, level = 4500, alpha = .7, draw = T) With the above…
fina
  • 429
  • 4
  • 12
5
votes
1 answer

R : combine and save rgl widgets as a single html file

In R, using the rgl and htmlwidgets libraries, I'm trying to extract an HTML file having a widget with toggle buttons. The following example does what I want in the RStudio Viewer. The HTML export works without the toggle buttons, but fails when the…
Olivier Delrieu
  • 742
  • 6
  • 16
5
votes
0 answers

How to smooth rgl plot? Plot is extremely stuttering,

This very simple plot is stucking when dragging, rotating, etc. It's not slow, but the extend is changing making it really difficult to follow the data. It's because of the axis labels which are repositioned during the interaction. But why is this…
agoldev
  • 2,078
  • 3
  • 23
  • 38
5
votes
1 answer

rgl.postscript when rgl.useNULL = TRUE

Shouldn't rgl.postscript() work for a headless server, i.e. when options(rgl.useNULL = TRUE)? I know that rgl.snapshot() won't work. library(rgl) options(rgl.useNULL = TRUE) open3d() x <- sort(rnorm(1000)) y <- rnorm(1000) z <- rnorm(1000) +…
jorkku
  • 137
  • 1
  • 12
5
votes
3 answers

interactive 3D plots in markdown file - not working anymore?

a couple of months ago, i wanted to embed a 3D interactive plot in a markdown file. looking at previous questions, i found this, which worked great (thanks for that, BTW). however, when i tried to re do it again today- i can only zoom in and out…
isomitzi
  • 131
  • 9
5
votes
0 answers

rgl vector diagrams: show right angles for orthogonal vectors

In the matlib package, https://github.com/friendly/matlib/, I have a function, vectors3d() to draw geometric vector diagrams. The following code gives an example figure showing a unit vector "J" and some of its projections on the X, Y, Z axes. In…
user101089
  • 3,756
  • 1
  • 26
  • 53
5
votes
1 answer

rglwidget: Cannot replace previous 3d plot

The example coming with package rglwidget is fairly complex; I created a simple shiny/rglwidget example below. The plot appears ok, but each time I toggle the checkbox, a new image is appended in the browser window. How can I replace/overwrite the…
Dieter Menne
  • 10,076
  • 44
  • 67
5
votes
1 answer

You must enable Javascript to view this page properly. error knitr rgl

I have knitr: 1.10.5 and rgl:0.95.1247. When i try the code: ```output: html_document: keep_md: yes``` ```{r setup, results='asis'} library(knitr) knit_hooks$set(webgl = hook_webgl) ``` ```{r testgl, webgl=TRUE} library(rgl) x <-…
Shat32
  • 51
  • 2
5
votes
1 answer

Using "expression" in R rgl axis labels

Do the rgl routines accept the use of "expression" for Greek letters and super/sub script for axis labelling? Something like xlab=(expression(paste("Lyman ",alpha,))) works perfectly well in a normal plot call but just seems to display…
5
votes
4 answers

R rgl package error while loading the library

My system environment: Mac OS 10.10.2 X11 (XQuartz 2.7.5) R 3.1.2 When I load and use 'rgl' package, I get following error message. > library("rgl",lib.loc="/Library/Frameworks/R.framework/Versions/3.1/Resources/library") Warning messages: 1: In…
user67275
  • 1
  • 9
  • 38
  • 64
5
votes
1 answer

R: adding droplines to fitted plane in 3D scatterplot in rgl

I was making a plot with a semi-transparent plane fitted through a cloud of points in rgl. I got as far…
Tom Wenseleers
  • 7,535
  • 7
  • 63
  • 103
5
votes
0 answers

rgl.snapshot produces a black file

Example: example(plot3d) rgl.snapshot('test.png') # snapshot3d('test.png') I become a black png file since today. > sessionInfo() R version 3.0.2 (2013-09-25) Platform: i386-w64-mingw32/i386 (32-bit) locale: [1] LC_COLLATE=German_Germany.1252 …
Trolli
  • 157
  • 2
  • 12
5
votes
3 answers

Plot 3D plane (true regression surface)

I'm trying to simulate some data (x1 and x2 - my explanatory variables), calculate y using a specified function + random noise and plot the resulting observations AND the true regression surface. Here's what I have so far: set.seed(1) …
user2249626
  • 453
  • 2
  • 6
  • 15