corplot: Plot local correlation maps

Description Usage Arguments Details References

View source: R/plotting.R

Description

Plot the estimated local correlation map (or local partial correlation map) for a pair of variables

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
corplot(
  dlg_object,
  pair = 1,
  gaussian_scale = FALSE,
  plot_colormap = TRUE,
  plot_obs = FALSE,
  plot_labels = TRUE,
  plot_legend = FALSE,
  plot_thres = 0,
  alpha_tile = 0.8,
  alpha_point = 0.8,
  low_color = "blue",
  high_color = "red",
  break_int = 0.2,
  label_size = 3,
  font_family = "sans",
  point_size = NULL,
  xlim = NULL,
  ylim = NULL,
  xlab = NULL,
  ylab = NULL,
  rholab = NULL,
  main = NULL,
  subtitle = NULL
)

Arguments

dlg_object

The density estimation object produced by the dlg-function

pair

Integer indicating which pair of variables you want to plot. The function looks up the corresponding variables in the bandwidth object used to calculate the dlg object, and you can inspect this in dlg_object$bw$joint. Defaults to 1 (the first pair, usually variable 1 against variable 2).

gaussian_scale

Logical, if TRUE the plot is produced on the marginal standard Gaussian scale.

plot_colormap

Logical, if TRUE the plot includes a colormap to visualize the value of the local correlation.

plot_obs

Logical, if TRUE the observations are plotted.

plot_labels

Logical, if TRUE character labels with local correlation values are plotted.

plot_legend

Logical, if TRUE a color legend is plotted.

plot_thres

A number between 0 and 1 indicating the threshold value to be used for not plotting the estimated local correlation in areas with no data. Uses a quick bivariate kernel density estimate a criterion, and skips plotting in areas with kernel density estimate less than the fraction plot_thres of the maximum density estimate. If 0 (default), everything is plotted, if 1 nothing is plotted. Typical values may be in the 0.001-0.01-range.

alpha_tile

The alpha-value indicating the transparency of the color tiles. Number between 0 (transparent) and 1 (not transparent).

alpha_point

he alpha-value indicating the transparency of the observations. Number between 0 (transparent) and 1 (not transparent).

low_color

The color corresponding to correlation equal to -1 (default: blue).

high_color

The color corresponding to correlation equal to 1 (default: red).

break_int

Break interval in the color gradient.

label_size

Size of text labels, if plotted.

font_family

Font family used for text labels, if plotted.

point_size

Size of points used for plotting the observations.

xlim

x-limits

ylim

y-limits

xlab

x-label

ylab

y-label

rholab

Label for the legend, if plotted

main

Title of plot

subtitle

Subtitle of plot

Details

This function plots a map of estimated local Gaussian correlations of a specified pair (defaults to the first pair) of variables as produced by the dlg-function. This plot is heavily inspired by the local correlation plots produced by the 'localgauss'-package by Berentsen et. al (2014), but it is here more easily customized and specially adapted to the ecosystem within the lg-package. The plotting is carried out using the ggplot2-package (Wickham, 2009). This function now also accepts objects created by the partial_cor()-function, in order to create local partial correlation maps.

References

Berentsen, G. D., Kleppe, T. S., & Tjøstheim, D. (2014). Introducing localgauss, an R package for estimating and visualizing local Gaussian correlation. Journal of Statistical Software, 56(1), 1-18.

H. Wickham. ggplot2: Elegant Graphics for Data Analysis. Springer-Verlag New York, 2009.


hotneim/lg documentation built on May 9, 2020, 7:35 a.m.