ggMatrixPlot: ggMatrixPlot

Description Usage Arguments Details Examples

View source: R/ggMatrixPlot.R

Description

ggMatrixPlot

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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
ggMatrixPlot(
  plotList = NULL,
  nr = NULL,
  nc = NULL,
  ...,
  leftLabels = NULL,
  topLabels = NULL,
  rightLabels = NULL,
  bottomLabels = NULL,
  removeXYlabels = c("xy", "x", "y", "none"),
  labelSize = 0.4 * graphOptions("fontsize"),
  labelPos = matrix(0.5, 4, 2),
  scaleXYlabels = c(0.9, 0.9),
  debug = FALSE
)

## S3 method for class 'matrix'
ggMatrixPlot(
  plotList = NULL,
  nr = NULL,
  nc = NULL,
  layout = NULL,
  ...,
  leftLabels = NULL,
  topLabels = NULL,
  rightLabels = NULL,
  bottomLabels = NULL,
  removeXYlabels = c("xy", "x", "y", "none"),
  labelSize = 0.4 * graphOptions("fontsize"),
  labelPos = matrix(0.5, 4, 2),
  scaleXYlabels = c(0.9, 0.9),
  debug = FALSE
)

## S3 method for class 'list'
ggMatrixPlot(
  plotList = NULL,
  nr = NULL,
  nc = NULL,
  layout = NULL,
  ...,
  leftLabels = NULL,
  topLabels = NULL,
  rightLabels = NULL,
  bottomLabels = NULL,
  removeXYlabels = c("xy", "x", "y", "none"),
  labelSize = 0.4 * graphOptions("fontsize"),
  labelPos = matrix(0.5, 4, 2),
  scaleXYlabels = c(0.9, 0.9),
  debug = FALSE
)

## Default S3 method:
ggMatrixPlot(
  plotList = NULL,
  nr = NULL,
  nc = NULL,
  layout = NULL,
  ...,
  leftLabels = NULL,
  topLabels = NULL,
  rightLabels = NULL,
  bottomLabels = NULL,
  removeXYlabels = c("xy", "x", "y", "none"),
  labelSize = 0.4 * graphOptions("fontsize"),
  labelPos = matrix(0.5, 4, 2),
  scaleXYlabels = c(0.9, 0.9),
  debug = FALSE
)

Arguments

plotList

a list of ggplot2 objects

nr

number of rows

nc

number of columns

...

ignored.

leftLabels

labels left of the plots in plotList.

topLabels

labels above the plots in plotList.

rightLabels

labels right of the plots in plotList.

bottomLabels

labels below the plots in plotList.

removeXYlabels

Whether to remove the x and y axes titles.

labelSize

two scalars for the magnification of the the x and y labels respectively.

labelPos

relative position for the labels around the plots. The first column contains x-coordinates and the second y-coordinates. The first row is top, second right, third bottom, and fourth left (TRouBLe).

scaleXYlabels

two scalars for the magnification of the the x and y labels respectively.

debug

create an debug plot (see examples).

layout

a matrix that specifies the position of each plot, akin to the layout for base plots.

Details

This function is intended to be called with a matrix as first argument, although other input is also supported.

Examples

 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
26
27
28
29
30
31
## Not run: 

library(ggplot2)
data("diamonds", package = "ggplot2")
vars  <- colnames(diamonds)[c(1, 5)]
nvars <- length(vars)

plotMatrix <- matrix(
  data = list(),
  nrow = nvars,
  ncol = nvars,
  dimnames = list(vars, vars)
)

for (i in seq_along(vars)) for (j in seq_along(vars)) {

  plotMatrix[[i, j]] <-
    ggplot(data = diamonds, aes_string(x = vars[i], y = vars[j])) +
    geom_point() +
    geom_rangeframe() +
    themeJaspRaw()

}

ggMatrixPlot(plotMatrix)

# gives an idea about how ggMatrixPlot works, you can add labels on all sides
# of the center (where the plots should be).
ggMatrixPlot(debug = TRUE)

## End(Not run)

vandenman/JASPgraphs documentation built on Dec. 16, 2021, 5:37 p.m.