Skip to contents

Plots the units (points) and optionally vectors/arrows for each unit in an ENA model using plotly.

Usage

units(
  x,
  ...,
  units_as_vectors = FALSE,
  unit_vectors_towards = "response",
  mean_vector_width = 5,
  mean_vector_arrow_size = 0.5,
  unit_vector_width = 3,
  unit_vector_arrow_size = 0.7,
  show_points = TRUE,
  point_shape = "circle",
  dynamic_response_point_size = FALSE,
  show_mean = TRUE,
  mean_value = NULL,
  points_color = "#FF0000",
  saturate_vectors_by = 0.2,
  point_position_multiplier = 1,
  distance_scaled_by = function(x) {
     scales::rescale(x, to = c(0.3, 1.5), from =
    c(0, 2))
 },
  with_lines = FALSE,
  with_ci = TRUE,
  points = NULL
)

Arguments

x

An ENA model object or plotly object with model attached.

...

Additional arguments passed to plotting functions.

units_as_vectors

Logical; if TRUE, plot unit vectors/arrows (default: FALSE).

unit_vectors_towards

Character; "response" or "ground" (default: "response").

mean_vector_width

Numeric; width of mean vector arrow (default: 5).

mean_vector_arrow_size

Numeric; size of mean vector arrowhead (default: 0.5).

unit_vector_width

Numeric; width of unit vector arrows (default: 3).

unit_vector_arrow_size

Numeric; size of unit vector arrowheads (default: 0.7).

show_points

Logical; if TRUE, show points (default: TRUE).

point_shape

Character; shape of points (default: "circle").

dynamic_response_point_size

Logical; if TRUE, scale response point size by distance (default: FALSE).

show_mean

Logical; if TRUE, show mean vector/point (default: TRUE).

mean_value

Optional; mean value to use (default: NULL).

points_color

Character; color for points (default: "#FF0000").

saturate_vectors_by

Numeric or function; controls vector color saturation (default: 0.2).

point_position_multiplier

Numeric; scales point positions (default: 1).

distance_scaled_by

Function; rescales distances for arrow size (default: scales::rescale).

with_lines

Logical; if TRUE, connect points with lines (default: FALSE).

with_ci

Logical; if TRUE, show confidence intervals (default: TRUE).

points

Optional; points to use (default: from model).

Value

A plotly object with ENA units (points and/or vectors) drawn.