Skip to contents

Creates 3D surface plots using plotly. Visualizes a continuous surface defined by x, y, z values. Used in physics, chemistry, engineering, and earth science.

Usage

Surface3D(
  x = NULL,
  y = NULL,
  z,
  type = c("surface", "wireframe"),
  color_name = NULL,
  palette = "Spectral",
  palcolor = NULL,
  opacity = 1,
  show_contour = FALSE,
  title = NULL,
  xlab = NULL,
  ylab = NULL,
  zlab = NULL,
  width = NULL,
  height = NULL,
  seed = 8525,
  ...
)

Arguments

x, y

Numeric vectors for grid coordinates.

z

A numeric matrix of surface height values.

type

Surface type: "surface" or "wireframe".

color_name

Legend title for color scale.

palette

Color palette name

palcolor

Custom colors for palette

opacity

Surface opacity.

show_contour

Whether to show contour lines on the surface.

title

Plot title

xlab

X-axis label

ylab

Y-axis label

zlab

Z-axis label (for 3D and ternary plots)

width, height

Plot dimensions in pixels.

seed

Random seed for reproducibility

...

Additional arguments.

Value

A plotly object

See also

Other 3d-interactive-plots: Scatter3D()

Examples

# \donttest{
x <- seq(-5, 5, length.out = 50)
y <- seq(-5, 5, length.out = 50)
z <- outer(x, y, function(a, b) sin(sqrt(a^2 + b^2)))
Surface3D(z = z, x = x, y = y)
# }