dplot3_xyz: Interactive 3D Plots

View source: R/dplot3_xyz.R

dplot3_xyzR Documentation

Interactive 3D Plots

Description

Draw interactive 3D plots using plotly

Usage

dplot3_xyz(
  x,
  y = NULL,
  z = NULL,
  fit = NULL,
  cluster = NULL,
  cluster.params = list(k = 2),
  group = NULL,
  formula = NULL,
  rsq = TRUE,
  mode = "markers",
  order.on.x = NULL,
  main = NULL,
  xlab = NULL,
  ylab = NULL,
  zlab = NULL,
  col = NULL,
  alpha = 0.8,
  bg = NULL,
  plot.bg = NULL,
  theme = rtTheme,
  palette = rtPalette,
  axes.square = FALSE,
  group.names = NULL,
  font.size = 16,
  marker.col = NULL,
  marker.size = 8,
  fit.col = NULL,
  fit.alpha = 0.7,
  fit.lwd = 2.5,
  tick.font.size = 12,
  spike.col = NULL,
  legend = NULL,
  legend.xy = c(0, 1),
  legend.xanchor = "left",
  legend.yanchor = "auto",
  legend.orientation = "v",
  legend.col = NULL,
  legend.bg = "#FFFFFF00",
  legend.border.col = "#FFFFFF00",
  legend.borderwidth = 0,
  legend.group.gap = 0,
  margin = list(t = 30, b = 0, l = 0, r = 0),
  fit.params = list(),
  width = NULL,
  height = NULL,
  padding = 0,
  displayModeBar = TRUE,
  modeBar.file.format = "svg",
  trace = 0,
  filename = NULL,
  file.width = 500,
  file.height = 500,
  file.scale = 1,
  ...
)

Arguments

x

Numeric, vector/data.frame/list: x-axis data. If y is NULL and NCOL(x) > 1, first two columns used as x and y, respectively

y

Numeric, vector/data.frame/list: y-axis data

z

Numeric, vector/data.frame/list: z-axis data

fit

Character: rtemis model to calculate y ~ x fit. Options: see select_learn() Can also be Logical, which will give a GAM fit if TRUE. If you specify "NLA", the activation function should be passed as a string.

cluster

Character: Clusterer name. Will cluster data.frame(x, y) and pass result to group. Run select_clust for options

cluster.params

List: Names list of parameters to pass to the cluster function

group

Vector: Will be converted to factor; levels define group members. Default = NULL

formula

Formula: Provide a formula to be solved using s_NLS. If provided, fit is forced to 'nls'. e.g. y ~ b * m ^ x for a power curve. Note: nls is powerful but is prone to errors and warnings. Use single letters for parameter names, no numbers.

rsq

Logical: If TRUE, print R-squared values in legend if fit is set

mode

Character, vector: "markers", "lines", "markers+lines".

order.on.x

Logical: If TRUE, order x and y on x. Default = NULL, which becomes TRUE if mode includes lines.

main

Character: Main plot title.

xlab

Character: x-axis label.

ylab

Character: y-axis label.

zlab

Character: z-axis label

col

Color for markers. Default=NULL, which will draw colors from palette

alpha

Float (0, 1]: Transparency for bar colors. Default = .8

bg

Background color

plot.bg

Plot background color

theme

List or Character: Either the output of a ⁠theme_*()⁠ function or the name of a theme. Use themes() to get available theme names. Theme functions are of the form ⁠theme_<name>⁠.

palette

Character: Name of rtemis palette to use. Default = "rtCol1". Only used if col = NULL

axes.square

Logical: If TRUE: draw a square plot to fill the graphic device. Default = FALSE. Note: If TRUE, the device size at time of call is captured and height and width are set so as to draw the largest square available. This means that resizing the device window will not automatically resize the plot.

group.names

Character, vector, length = NROW(x): Group names. Default = NULL, which uses rownames(x)

font.size

Float: Font size for all labels. Default = 16

marker.col

Color for marker

marker.size

Numeric: Marker size.

fit.col

Color: Color of the fit line.

fit.alpha

Float [0, 1]: Transparency for fit line

fit.lwd

Float: Fit line width

tick.font.size

Numeric: Tick font size

spike.col

Spike lines color

legend

Logical: If TRUE, draw legend. Default = NULL, which will be set to TRUE if there are more than 1 groups, or fit is set

legend.xy

Numeric, vector, length 2: x and y for plotly's legend

legend.xanchor

Character: Legend's x anchor: "left", "center", "right", "auto"

legend.yanchor

Character: Legend's y anchor: "top", "middle", "bottom", "auto"

legend.orientation

"v" or "h" for vertical or horizontal

legend.col

Color: Legend text color. Default = NULL, determined by theme

legend.bg

Color: Background color for legend

legend.border.col

Color: Border color for legend

legend.borderwidth

Numeric: Border width for legend

legend.group.gap

Numeric: Gap between legend groups

margin

Numeric, named list: Margins for top, bottom, left, right. Default = ⁠list(t = 30, b = 0, l = 0, r = 0⁠

fit.params

List: Arguments for learner defined by fit. Default = NULL, i.e. use default learner parameters

width

Numeric: Force plot size to this width. Default = NULL, i.e. fill available space

height

Numeric: Force plot size to this height. Default = NULL, i.e. fill available space

padding

Numeric: Graph padding.

displayModeBar

Logical: If TRUE, show plotly's modebar

modeBar.file.format

Character: "svg", "png", "jpeg", "pdf" / any output file type supported by plotly and your system

trace

Integer: The height the number the more diagnostic info is printed to the console

filename

Character: Path to file to save static plot. Default = NULL

file.width

Integer: File width in pixels for when filename is set.

file.height

Integer: File height in pixels for when filename is set.

file.scale

Numeric: If saving to file, scale plot by this number

...

Additional arguments passed to theme

Details

Note that dplot3_xyz uses the theme's plot.bg as grid.col

Author(s)

E.D. Gennatas

Examples

## Not run: 
dplot3_xyz(iris, group = iris$Species, theme = "darkgrid")

## End(Not run)

egenn/rtemis documentation built on Oct. 28, 2024, 6:30 a.m.