Skip to contents

Overview

Interactive box plots refers to the graphical representations that allow users to explore and analyze data through an interactive interface. They provide a way to visualize the distribution, central tendency, and variability of a dataset using a box-and-whisker plot, while also providing additional interactivity for deeper exploration.

Some common interactive features of the box plots include:

  • Hovering: When the user hovers the mouse cursor over a specific part of the plot, additional information related to that specific data point or summary statistic is displayed. This includes the descriptive statistics (N, Mean, Median, Q1, Q3, Min and Max), Subject ID and Change from Baseline

  • Filtering: It is possible to apply filters to the data, enabling users to select specific Parameter from a domain (Labs, Vitals, ECG)

Mental model

Creating the box plot using this package involves the below steps:

  • Create a list of metadata (Ex: meta) using meta_boxly()
  • Call prepare_boxly() function to prepare the metadata as required by the user
  • Call boxly() function to create the interactive plot

Example 1: Interactive Box Plot Using Labs Data

Step1: Create a list of metadata (Ex: meta) using meta_boxly()

meta <- meta_boxly(
  boxly_adsl,
  boxly_adlb,
  population_term = "apat",
  observation_term = "wk12",
  observation_subset = AVISITN <= 12 & !is.na(CHG)
)

Step2: Call prepare_boxly() function to prepare the metadata as required by the user

outdata <- prepare_boxly(meta)
outdata
#> List of 14
#>  $ meta             :List of 7
#>  $ population       : chr "apat"
#>  $ observation      : chr "wk12"
#>  $ parameter        : chr "SODIUM;K;CL;BILI;ALP;GGT;ALT;AST;BUN;CREAT;URATE;PHOS"
#>  $ n                :'data.frame':   180 obs. of  5 variables:
#>  $ order            : NULL
#>  $ group            : NULL
#>  $ reference_group  : NULL
#>  $ x_var            : chr "AVISITN"
#>  $ y_var            : chr "CHG"
#>  $ group_var        : chr "TRTA"
#>  $ param_var        : chr "PARAM"
#>  $ hover_var_outlier: chr [1:2] "USUBJID" "CHG"
#>  $ plotds           :'data.frame':   12212 obs. of  15 variables:

Step 3: Call boxly() function to create the interactive plot

boxly(outdata)