Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

plot3d.formula

Methods for formulas


Description

These functions provide a simple formula-based interface to plot3d and persp3d.

Usage

## S3 method for class 'formula'
plot3d(x, data = NULL, xlab, ylab, zlab, ...)
## S3 method for class 'formula'
persp3d(x, data = NULL, xlab, ylab, zlab, ...)

Arguments

x

A formula like z ~ x + y.

data

An optional dataframe or list in which to find the components of the formula.

xlab, ylab, zlab

Optional axis labels to override the ones automatically obtained from the formula.

...

Additional arguments to pass to the default plot3d method, or the persp3d method for "deldir" objects.

Details

Only simple formulas (the ones handled by the xyz.coords function) are supported: a single variable on the left hand side (which will be plotted on the Z axis), and a sum of two variables on the right hand side (which will be the X and Y axis variables in the plot.)

Value

These functions are called for the side effect of drawing the plots. The plot3d method draws a scatterplot. The persp3d method draws a surface plot.

Return values are as given by the plot3d.default method or the persp3d.deldir methods.

Note

The persp3d method requires that the suggested package deldir is installed.

Author(s)

Duncan Murdoch

Examples

open3d()
mfrow3d(1, 2, sharedMouse = TRUE)
plot3d(mpg ~ wt + qsec, data = mtcars)
if (requireNamespace("deldir", quietly = TRUE))
  persp3d(mpg ~ wt + qsec, data = mtcars)

rgl

3D Visualization Using OpenGL

v0.106.8
GPL
Authors
Duncan Murdoch [aut, cre], Daniel Adler [aut], Oleg Nenadic [ctb], Simon Urbanek [ctb], Ming Chen [ctb], Albrecht Gebhardt [ctb], Ben Bolker [ctb], Gabor Csardi [ctb], Adam Strzelecki [ctb], Alexander Senger [ctb], The R Core Team [ctb, cph], Dirk Eddelbuettel [ctb], The authors of Shiny [cph], The authors of knitr [cph], Jeroen Ooms [ctb], Yohann Demont [ctb], Joshua Ulrich [ctb], Xavier Fernandez i Marin [ctb], George Helffrich [ctb], Ivan Krylov [ctb]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.