Chapter 7 Charts
MultiNav provides several basic charts that are used as building blocks for the interactive displays. These charts can also be used as stand-alone.
First let’s create some data:
library(MultiNav)
library(MASS)
set.seed(1234)
n <- 300
Sigma <- matrix(c(1.0, .80, .50, .20,
.80, 1.0, .05, .05,
.50, .05, 1.0, .05,
.20, .05, .05, 1.0), ncol = 4)
data <- data.frame(mvrnorm(n, Sigma, mu = c(100,100,100,100), empirical = TRUE))
data<- cbind(seq_id=row.names(data), data)
7.1 Line chart
Simple line chart.
MultiNav(data,type = “line”, x, y)
Arguments:
data - Dataset in data.table
, data.frame
or matrix
fromat to use for plot.
x - variable name of x values.
y - variable name for y values.
Example:
MultiNav(data,type = "line","seq_id", "X1")
7.2 Scatter plot
Simple scatter plot chart.
MultiNav(data,type = “scatter”, x, y)
Arguments:
data - Dataset in data.table
, data.frame
or matrix
fromat to use for plot.
x - variable name of x values.
y - variable name for y values.
Example:
MultiNav(data,"scatter","X1", "X2")
7.3 Network chart
Network chart, with force layout.
MultiNav(data,type = “network”)
Arguments:
data - Dataset in data.table
, data.frame
or matrix
fromat. The dataset should have columns named: “from”, “to”, “weight”. The weight should be scaled to the numeric range 0-300.
Example:
library(igraph)
data <- DendrometerSensors
cor<-cor(data,use="pairwise.complete.obs")
g <- graph.adjacency((1-cor)*150,weighted=TRUE, diag=FALSE,mode= "upper")
network <- get.data.frame(g)
head(network)
## from to weight
## 1 101 102 5.259130
## 2 101 103 5.546034
## 3 101 104 278.719913
## 4 101 105 9.891307
## 5 101 106 11.771402
## 6 101 107 7.889799
MultiNav(network,type = "network")
7.4 Functional boxplot
The functional boxplot provides a visual tool for understanding the behavior of majority of the data over time. In our functional boxplot, the inner envelope, shows the range between the 25th percentile of the readings over time, and the 75th percentile. The outer envelope is drawn with a brighter color, and shows the range from the 5th percentile to the 95th percentile of the readings over time (containing 90% of the data).
MultiNav(data, type = “functional_box”, raw_data)
Arguments:
data - Dataset in data.table
, data.frame
or matrix
format. The dataset should have columns named: seq_id“,”min“,”quantile_a“,”quantile_b“,”median“,”quantile_c“,”quantile_d“,”max"
Optional arguments:
raw_data - Dataset containing the raw data used for calculating the functional boxplot.
line_id - The column name of the variable to be drawn as a line chart on top of the functional boxplot.
Example:
data <- DendrometerSensors
data<-cbind(seq_id=as.numeric(row.names(data)), data)
uni_matrix<-Calc_uni_matrix(as.data.frame(data))
quantiles_matrix<-Calc_quantiles_matrix(as.data.frame(data))
MultiNav(quantiles_matrix,type = "functional_box")
Example:
MultiNav(quantiles_matrix,type = "functional_box_with_line",
raw_data = data, line_id="185")