Skip to contents

Draw interactive 3D scatter plots using plotly.

Usage

draw_3Dscatter(
  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 = rtemis_theme,
  palette = rtemis_palette,
  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 = NULL,
  width = NULL,
  height = NULL,
  padding = 0,
  displayModeBar = TRUE,
  modeBar_file_format = "svg",
  verbosity = 0L,
  filename = NULL,
  file_width = 500,
  file_height = 500,
  file_scale = 1,
  ...
)

Arguments

x

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

y

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

z

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

fit

Character: Fit method.

cluster

Character: Clustering method.

cluster_params

List: Parameters for clustering.

group

Factor: Grouping variable.

formula

Formula: Formula for non-linear least squares fit.

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.

main

Character: Main title.

xlab

Character: x-axis label.

ylab

Character: y-axis label.

zlab

Character: z-axis label.

col

Color for markers.

alpha

Numeric: Alpha for markers.

bg

Background color.

plot_bg

Plot background color.

theme

List: Plot theme.

palette

Character: Color palette.

axes_square

Logical: If TRUE, draw a square plot.

group_names

Character: Names for groups.

font_size

Numeric: Font size.

marker_col

Color for markers.

marker_size

Numeric: Marker size.

fit_col

Color for fit line.

fit_alpha

Numeric: Alpha for fit line.

fit_lwd

Numeric: Line width for fit line.

tick_font_size

Numeric: Tick font size.

spike_col

Spike lines color.

legend

Logical: If TRUE, draw legend.

legend_xy

Numeric: Position of legend.

legend_xanchor

Character: X anchor for legend.

legend_yanchor

Character: Y anchor for legend.

legend_orientation

Character: Orientation of legend.

legend_col

Color for legend text.

legend_bg

Color for legend background.

legend_border_col

Color for legend border.

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.

fit_params

Hyperparameters: Parameters for fit.

width

Numeric: Width of plot.

height

Numeric: Height of plot.

padding

Numeric: Graph padding.

displayModeBar

Logical: If TRUE, display mode bar.

modeBar_file_format

Character: File format for mode bar.

verbosity

Integer: Verbosity level.

filename

Character: Filename to save plot.

file_width

Numeric: Width of saved file.

file_height

Numeric: Height of saved file.

file_scale

Numeric: Scale of saved file.

...

Additional arguments passed to the theme function.

Value

A plotly object.

Details

Note that draw_3Dscatter uses the theme's plot_bg as grid_col.

Author

EDG

Examples

if (FALSE) { # \dontrun{
draw_3Dscatter(iris, group = iris$Species, theme = "darkgrid")
} # }