Code Monkey home page Code Monkey logo

graph3d's Introduction

graph3d Customize 3D graphs in R

Installation

if(!require(devtools)) install.packages("devtools")
devtools::install_github("kassambara/graph3d")

Geting started

Quick RGL scater plot

require(rgl)
#> Loading required package: rgl
data(iris)
x <- iris$Sepal.Length
y <- iris$Petal.Length
z <- iris$Sepal.Width
rgl_scatter(iris, groups = iris$Species, add.ellipse = TRUE,
            data.scale = TRUE)

Remove the bounding box:

rgl_scatter(iris, groups = iris$Species, show.bbox = FALSE)

Add regression planes

rgl_scatter(iris, groups = iris$Species, show.bbox = FALSE, add.reg.planes = TRUE)

Build customized RGL plots

rgl_init()
rgl.spheres(x, y, z, r = 0.2, color = get_colors(iris$Species))
rgl_add_axes(x, y, z, show.bbox = TRUE)
rgl_add_ellipses(x, y, z, groups = iris$Species)
aspect3d(1,1,1)

Add grids to a scatterplot3d

The function s3d_addgrids() can be used as follow:

library("scatterplot3d")

data(iris)

# Basic 3d graphics
scatterplot3d(iris[,1:3])

# Remove box and add grids
scatterplot3d(iris[, 1:3], pch = 16, grid = TRUE, box = FALSE)
s3d_addgrids(iris[, 1:3], grid = c("xy", "xz", "yz"))

3D histogram distribution

# quakes dataset
data("quakes")
dist3d(quakes$long, quakes$lat, colvar=quakes$depth,
             breaks = 30, col.bar = "steelblue")

# Iris dataset
dist3d(iris$Sepal.Length, iris$Petal.Width, col.bar = "steelblue", 
             colvar=as.numeric(iris$Species))

graph3d's People

Contributors

kassambara avatar

Stargazers

 avatar

Watchers

 avatar e.o.ozdamar avatar  avatar  avatar

Forkers

guhjy

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.