Skip to contents

Experimental 2D and 3D Scatter Plots for Delta-Scale Pairwise Correlations

Usage

delta_scatter(
  x,
  timediff1 = "2-1",
  timediff2 = "3-2",
  timediff3 = NULL,
  fisherz = TRUE,
  interactive = TRUE,
  digits = 3
)

Arguments

x

Input covariate array, with n rows, p columns, and t slices

timediff1

First pair of time points for the x-axis of the scatter plot. Should be in format 't2-t1'

timediff2

Second pair of time points for the y-axis of the scatter plot. Should be in format 't2-t1'

timediff3

Optional third pair of time points for the z-axis of the scatter plot. Should be in format 't2-t1'

fisherz

If TRUE, the Fisher z-transformation (atanh) will be applied to the correlations

interactive

If TRUE and timediff3 is NULL, an interactive plotly plot with hover text containing correlations and variable names will be generated. If FALSE and timediff3 is NULL, a regular ggplot2 scatterplot will be shown. If timediff3 is provided, this parameter will only determine whether hovertext is shown

digits

Number of digits for rounding in the hovertext

Value

Either a 2D or 3D scatterplot

References

Wickham H (2016). ggplot2: Elegant Graphics for Data Analysis. Springer-Verlag New York. ISBN 978-3-319-24277-4, https://ggplot2.tidyverse.org. Sievert C (2020). Interactive Web-Based Data Visualization with R, plotly, and shiny. Chapman and Hall/CRC. ISBN 9781138331457, https://plotly-r.com.

Examples

if (FALSE) {
delta_scatter(Xarray)
delta_scatter(Xarray, timediff3 = "4-3")
delta_scatter(Xarray, timediff1 = "3-1", timediff2 = "5-3", timediff3 = "7-5")
}