Jump to content

File:Threejs 3d.png

From 太極
Revision as of 13:50, 19 February 2026 by Brb (talk | contribs) (<syntaxhighlight lang='r'> # method 2. High-performance WebGL: threejs (great for large datasets) library(threejs) # numeric color vector by Species cols <- as.numeric(iris$Species) pal <- rainbow(length(unique(cols))) widget <- scatterplot3js( x = iris$Sepal.Length, y = iris$Sepal.Width, z = iris$Petal.Length, color = pal[cols], size = .8, # control marker sizes grid = TRUE, renderer = "auto", # or "webgl" (webgl recommended for speed) bg = "white", l...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Original file (1,472 × 1,074 pixels, file size: 163 KB, MIME type: image/png)

Summary

# method 2. High-performance WebGL: threejs (great for large datasets)
library(threejs)

# numeric color vector by Species
cols <- as.numeric(iris$Species)
pal <- rainbow(length(unique(cols)))

widget <- scatterplot3js(
  x = iris$Sepal.Length,
  y = iris$Sepal.Width,
  z = iris$Petal.Length,
  color = pal[cols],
  size = .8,       # control marker sizes
  grid = TRUE,
  renderer = "auto",                # or "webgl" (webgl recommended for speed)
  bg = "white",
  labels = paste0("Specimen: ", 1:nrow(iris))
)
widget 
# Use htmlwidgets::saveWidget(widget, "iris_threejs.html", selfcontained = TRUE)

File history

Click on a date/time to view the file as it appeared at that time.

Date/TimeThumbnailDimensionsUserComment
current13:50, 19 February 2026Thumbnail for version as of 13:50, 19 February 20261,472 × 1,074 (163 KB)Brb (talk | contribs)<syntaxhighlight lang='r'> # method 2. High-performance WebGL: threejs (great for large datasets) library(threejs) # numeric color vector by Species cols <- as.numeric(iris$Species) pal <- rainbow(length(unique(cols))) widget <- scatterplot3js( x = iris$Sepal.Length, y = iris$Sepal.Width, z = iris$Petal.Length, color = pal[cols], size = .8, # control marker sizes grid = TRUE, renderer = "auto", # or "webgl" (webgl recommended for speed) bg = "white", l...

The following page uses this file: