- x
A character string specifying the name of the first predictor variable.
- z
A character string specifying the name of the second predictor variable.
- y
A character string specifying the name of the outcome variable.
- model
A model object of class modsem_pi, modsem_da, modsem_mplus, or lavaan. The model should
include paths for the predictors (x, z, and xz) to the outcome (y).
- min_x
Numeric. Minimum value of x in z-scores. Default is -3.
- max_x
Numeric. Maximum value of x in z-scores. Default is 3.
- min_z
Numeric. Minimum value of z in z-scores. Default is -3.
- max_z
Numeric. Maximum value of z in z-scores. Default is 3.
- standardized
Should coefficients be standardized beforehand?
- detail
Numeric. Step size for the grid of x and z values, determining the resolution of the surface.
Smaller values increase plot resolution. Default is 1e-2.
- xz
Optional. A character string or vector specifying the interaction term between x and z.
If NULL, the interaction term is constructed as paste(x, z, sep = ":") and adjusted for specific model classes.
- colorscale
Character or list. Colorscale used to color the surface.
- Default is "Viridis", which matches the classic Plotly default.
- Can be a built-in palette name (e.g., "Greys", "Plasma", "Turbo"),
or a custom two-column list with numeric stops (0–1) and color codes.
Example custom scale:
list(c(0, "white"), c(1, "black")) for a black-and-white gradient.
- reversescale
Logical. If TRUE, reverses the color mapping so that
low values become high colors and vice versa.
Default is FALSE.
- showscale
Logical. If TRUE, displays the colorbar legend
alongside the plot.
Default is TRUE.
- cmin
Numeric or NULL. The minimum value for the colorscale mapping.
If NULL, the minimum of the data (proj_y) is used automatically.
Use this to standardize the color range across multiple plots.
- cmax
Numeric or NULL. The maximum value for the colorscale mapping.
If NULL, the maximum of the data (proj_y) is used automatically.
Use this to standardize the color range across multiple plots.
- surface_opacity
Numeric (0–1). Controls the opacity of the surface.
- 1 = fully opaque (default)
- 0 = fully transparent
Useful when overlaying multiple surfaces or highlighting gridlines.
- grid
Logical. If TRUE, draws gridlines (wireframe)
directly on the surface using Plotly's contour features.
Default is FALSE.
- grid_nx
Integer. Approximate number of gridlines to draw along the
**x-axis** direction when grid = TRUE.
Higher values create a denser grid.
Default is 12.
- grid_ny
Integer. Approximate number of gridlines to draw along the
**y-axis** direction when grid = TRUE.
Higher values create a denser grid.
Default is 12.
- grid_color
Character. Color of the gridlines drawn on the surface.
Must be a valid CSS color string, including rgba() for transparency.
- Default is "rgba(0,0,0,0.45)" (semi-transparent black).
Example: "rgba(255,255,255,0.8)" for semi-transparent white lines.
- group
Which group to create surface plot for. Only relevant for multigroup
models. Must be an integer index, representing the nth group.
- ...
Additional arguments passed to plotly::plot_ly.