EHRtemporalVariability (version 1.0)

plotIGTProjection: Information Geometric Temporal plot

Description

Plots an interactive Information Geometric Temporal (IGT) plot from an IGTProjection object. An IGT plot visualizes the variability among time batches in a data repository in a 2D or 3D plot. Time batches are positioned as points where the distance between them represents the probabilistic distance between their distributions (currently Jensen-Shannon distance, more distances will be supported in the future). To track the temporal evolution, temporal batches are labeled to show their date and colored according to their season or period, according to the analysis period, as follows. If period=="year" the label is "yy" (2 digit year) and the color is according to year. If period=="month" the label is "yym" (yy + abbreviated month*) and the color is according to the season (yearly). If period=="week" the label is "yymmw" (yym + ISO week number in 1-2 digit) and the color is according to the season (yearly). *Month abbreviations: {'J', 'F', 'M', 'A', 'm', 'j', 'x', 'a', 'S', 'O', 'N', 'D'}.

Usage

plotIGTProjection(igtProjection, dimensions = 3,
  startDate = min(igtProjection@dataTemporalMap@dates),
  endDate = max(igtProjection@dataTemporalMap@dates),
  colorPalette = "Spectral")

# S4 method for IGTProjection plotIGTProjection(igtProjection, dimensions = 3, startDate = min(igtProjection@dataTemporalMap@dates), endDate = max(igtProjection@dataTemporalMap@dates), colorPalette = "Spectral")

Arguments

igtProjection

of class IGTProjection

dimensions

number of dimensions of the plot, 2 or 3 (3 by default)

startDate

a Date object indicating the first date to be displayed in the IGT plot. By default the first date of the IGTProjection object.

endDate

a Date object indicating the last date to be displayed in the IGT plot By default the last date of the IGTProjection object.

colorPalette

color palette to be used. The default "Spectral" palette shows a color temperature scheme from blue, through yellow, to red (see "Spectral" palette in RColorBrewer package). The four remaining options are better suited for those with colorblindness, including "Viridis", "Magma", and their reversed versions "Viridis-reversed" and "Magma-reversed" (see "Viridis" and "Magma" palettes in the Viridis package).

Value

A plot object based on the plotly package.

Details

Note that since the projection is based on Classical Multi Dimensional Scaling, a 2 dimensional projection entails a loss of information compared to a 3 dimensional projection. E.g., periodic variability components such as seasonal effect can be hindered by an abrupt change or a general trend.

Examples

Run this code
# NOT RUN {
load(system.file("extdata",
                 "variabilityDemoNHDSdiagcode1-phewascode.RData",
                  package="EHRtemporalVariability"))

p <- plotIGTProjection( igtProjection   =  igtProjs[[1]],
                        colorPalette    = "Spectral",
                        dimensions      = 2)
p

# }
# NOT RUN {
# For additional and larger examples download the following .Rdata file:

githubURL <- "https://github.com/hms-dbmi/EHRtemporalVariability-DataExamples/raw/master/variabilityDemoNHDS.RData"
load(url(githubURL))
plotIGTProjection(igtProjs$`diagcode1-phewascode`, dimensions = 3)
# }

Run the code above in your browser using DataCamp Workspace