Learn R Programming

vectorialcalculus (version 1.0.5)

plot_curve3d: Plot a 3D parametric curve with plotly

Description

Creates an interactive 3D plot of a parametric curve given a tibble with columns t, x, y, z (typically produced by curve_sample3d()).

Usage

plot_curve3d(
  data,
  mode = "lines",
  line = list(color = "blue", width = 3, dash = "solid"),
  marker = NULL,
  title = NULL,
  scene = list(xaxis = list(title = "x(t)"), yaxis = list(title = "y(t)"), zaxis =
    list(title = "z(t)")),
  bg = list(paper = "white", plot = "white")
)

Value

A plotly object, which is printed for interactive visualization.

Arguments

data

Tibble with columns t, x, y, z.

mode

Character string. Plotly trace mode, e.g. "lines" or "lines+markers".

line

List with line styling options, such as list(color = "blue", width = 3, dash = "solid").

marker

Optional list with marker styling options, or NULL to omit markers.

title

Optional character string for the plot title.

scene

List specifying 3D axis titles and options, passed to plotly::layout(), typically including xaxis, yaxis, and zaxis.

bg

List with background colors, e.g. list(paper = "white", plot = "white").

Details

This function requires the plotly package to be installed.

See Also

curve_sample3d(), arc_length3d()

Examples

Run this code
data <- curve_sample3d(
  function(t) 2 * cos(t),
  function(t) 3 * sin(t),
  function(t) t / 5,
  0, 2 * pi, 100
)
# \donttest{
if (requireNamespace("plotly", quietly = TRUE)) {
  plot_curve3d(data, line = list(color = "red", width = 4))
}
# }

Run the code above in your browser using DataLab