plot.mat: Functions for plotting a partitioned matrix (representing the...

Description Usage Arguments Value Author(s) References See Also Examples

Description

The main function plot.mat or plotMat plots a (optionally partitioned) matrix. If the matrix is partitioned, the rows and columns of the matrix are rearranged according to the partitions. Other functions are only wrappers for plot.mat or plotMat for convenience when plotting the results of the corresponding functions. The plot.mat.nm or plotMatNm plots two matrices based on M, normalized by rows and columns, next to each other. The plot.array or plotArray plots an array.

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
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
plot.mat(x = M, M = x, clu = NULL, 
                ylab = "", xlab = "", main =
                 NULL, print.val = !length(table(M)) <= 2, print.0 =
                 FALSE, plot.legend = !print.val && !length(table(M))
                 <= 2, print.legend.val = "out", print.digits.legend =
                 2, print.digits.cells = 2, print.cells.mf = NULL,
                 outer.title = FALSE, title.line = ifelse(outer.title,
                 -1.5, 7), mar = c(0.5, 7, 8.5, 0) + 0.1, cex.val =
                 "default", val.y.coor.cor = 0, val.x.coor.cor = 0,
                 cex.legend = 1, legend.title = "Legend", cex.axes =
                 "default", print.axes.val = NULL, print.x.axis.val =
                 !is.null(colnames(M)), print.y.axis.val =
                 !is.null(rownames(M)), x.axis.val.pos = 1.01,
                 y.axis.val.pos = -0.01, cex.main = par()$cex.main,
                 cex.lab = par()$cex.lab, yaxis.line = -1.5, xaxis.line
                 = -1, legend.left = 0.4, legend.up = 0.03, legend.size
                 = 1/min(dim(M)), legend.text.hor.pos = 0.5,
                 par.line.width = 3, par.line.col = "blue", IM.dens =
                 NULL, IM = NULL, wnet = NULL, wIM = NULL, use.IM =
                 length(dim(IM)) == length(dim(M)) | !is.null(wIM),
                 dens.leg = c(null = 100, nul = 100), blackdens = 70,
                 plotLines = FALSE, frameMatrix = TRUE, x0ParLine =
                 -0.1, x1ParLine = 1, y0ParLine = 0, y1ParLine = 1.1,
                 colByUnits = NULL, colByRow = NULL, colByCol = NULL,
                 mulCol = 2, joinColOperator = "+", colTies = FALSE,
                 maxValPlot = NULL, printMultipliedMessage = TRUE,
                 replaceNAdiagWith0 = TRUE, ...)
                 
                 
plotMat(x = M, M = x, clu = NULL, 
                ylab = "", xlab = "", main =
                 NULL, print.val = !length(table(M)) <= 2, print.0 =
                 FALSE, plot.legend = !print.val && !length(table(M))
                 <= 2, print.legend.val = "out", print.digits.legend =
                 2, print.digits.cells = 2, print.cells.mf = NULL,
                 outer.title = FALSE, title.line = ifelse(outer.title,
                 -1.5, 7), mar = c(0.5, 7, 8.5, 0) + 0.1, cex.val =
                 "default", val.y.coor.cor = 0, val.x.coor.cor = 0,
                 cex.legend = 1, legend.title = "Legend", cex.axes =
                 "default", print.axes.val = NULL, print.x.axis.val =
                 !is.null(colnames(M)), print.y.axis.val =
                 !is.null(rownames(M)), x.axis.val.pos = 1.01,
                 y.axis.val.pos = -0.01, cex.main = par()$cex.main,
                 cex.lab = par()$cex.lab, yaxis.line = -1.5, xaxis.line
                 = -1, legend.left = 0.4, legend.up = 0.03, legend.size
                 = 1/min(dim(M)), legend.text.hor.pos = 0.5,
                 par.line.width = 3, par.line.col = "blue", IM.dens =
                 NULL, IM = NULL, wnet = NULL, wIM = NULL, use.IM =
                 length(dim(IM)) == length(dim(M)) | !is.null(wIM),
                 dens.leg = c(null = 100, nul = 100), blackdens = 70,
                 plotLines = FALSE, frameMatrix = TRUE, x0ParLine =
                 -0.1, x1ParLine = 1, y0ParLine = 0, y1ParLine = 1.1,
                 colByUnits = NULL, colByRow = NULL, colByCol = NULL,
                 mulCol = 2, joinColOperator = "+", colTies = FALSE,
                 maxValPlot = NULL, printMultipliedMessage = TRUE,
                 replaceNAdiagWith0 = TRUE, ...)


plot.mat.nm(x = M, M = x, ..., main.title = NULL,
   title.row = "Row normalized",
   title.col = "Column normalized",
   main.title.line = -2, par.set = list(mfrow = c(1, 2)))


plotMatNm(x = M, M = x, ..., main.title = NULL,
   title.row = "Row normalized",
   title.col = "Column normalized",
   main.title.line = -2, par.set = list(mfrow = c(1, 2)))



plot.array(x = M, M = x, ..., main.title = NULL, main.title.line
                 = -2, mfrow = NULL)

        
plotArray(x = M, M = x, ..., main.title = NULL, main.title.line
                 = -2, mfrow = NULL)

## S3 method for class 'mat'
plot(x = M, M = x, clu = NULL, 
                  ylab = "", xlab = "", main =
                 NULL, print.val = !length(table(M)) <= 2, print.0 =
                 FALSE, plot.legend = !print.val && !length(table(M))
                 <= 2, print.legend.val = "out", print.digits.legend =
                 2, print.digits.cells = 2, print.cells.mf = NULL,
                 outer.title = FALSE, title.line = ifelse(outer.title,
                 -1.5, 7), mar = c(0.5, 7, 8.5, 0) + 0.1, cex.val =
                 "default", val.y.coor.cor = 0, val.x.coor.cor = 0,
                 cex.legend = 1, legend.title = "Legend", cex.axes =
                 "default", print.axes.val = NULL, print.x.axis.val =
                 !is.null(colnames(M)), print.y.axis.val =
                 !is.null(rownames(M)), x.axis.val.pos = 1.01,
                 y.axis.val.pos = -0.01, cex.main = par()$cex.main,
                 cex.lab = par()$cex.lab, yaxis.line = -1.5, xaxis.line
                 = -1, legend.left = 0.4, legend.up = 0.03, legend.size
                 = 1/min(dim(M)), legend.text.hor.pos = 0.5,
                 par.line.width = 3, par.line.col = "blue", IM.dens =
                 NULL, IM = NULL, wnet = NULL, wIM = NULL, use.IM =
                 length(dim(IM)) == length(dim(M)) | !is.null(wIM),
                 dens.leg = c(null = 100, nul = 100), blackdens = 70,
                 plotLines = FALSE, frameMatrix = TRUE, x0ParLine =
                 -0.1, x1ParLine = 1, y0ParLine = 0, y1ParLine = 1.1,
                 colByUnits = NULL, colByRow = NULL, colByCol = NULL,
                 mulCol = 2, joinColOperator = "+", colTies = FALSE,
                 maxValPlot = NULL, printMultipliedMessage = TRUE,
                 replaceNAdiagWith0 = TRUE, ...)

## S3 method for class 'crit.fun'
plot(x, main = NULL, ...)

## S3 method for class 'opt.par'
plot(x, main = NULL, which = 1, ...)

## S3 method for class 'opt.par.mode'
plot(x, main = NULL, which = 1, ...)

## S3 method for class 'opt.more.par'
plot(x, main = NULL, which = 1, ...)

## S3 method for class 'opt.more.par.mode'
plot(x, main = NULL, which = 1, ...)

Arguments

x

A result from a corespodning function or a matrix or similar object representing a network.

M

A matrix or similar object representing a network - either x or M must be supplied - both are here to make the code compatible with generic and with older functions.

clu

A partition. Each unique value represents one cluster. If the network is one-mode, than this should be a vector, else a list of vectors, one for each mode.

ylab

Label for y axis.

xlab

Label for x axis.

main

Main title.

main.title

Main title in plot.array version.

main.title.line

The line in which main title is printed in plot.array version.

mfrow

mfrow argument to par - number of row and column plots to be ploted on one figure.

print.val

Should the values be printed in the matrix.

print.0

If print.val = TRUE Should the 0s be printed in the matrix.

plot.legend

Should the legend for shades be ploted.

print.legend.val

Should the values be printed in the legend.

print.digits.legend

The number of digits that should appear in the legend.

print.digits.cells

The number of digits that should appear in the cells (of the matrix and/or legend).

print.cells.mf

if not NULL, the above argument is igonred, the cell values are printed as the cell are multiplied by this factor and rounded.

outer.title

Should the title be printed on the 'inner' or 'outer' plot, default is 'inner'.

title.line

The line (from the top) where the title should be printed. The suitable values depend heavily on the displey type.

mar

A numerical vector of the form c(bottom, left, top, right) which gives the lines of margin to be specified on the four sides of the plot. The R default for ordianry plots is c(5, 4, 4, 2) + 0.1, while this functions default is c(0.5, 7, 8.5, 0) + 0.1.

cex.val

Size of the values printed. The default is 10/'number of units'.

val.y.coor.cor

Correction for centering the values in the sqares in y direction.

val.x.coor.cor

Correction for centering the values in the sqares in x direction.

cex.legend

Size of the text in the legend.

legend.title

The title of the legend.

cex.axes

Size of the characters in axes. Default makes the cex so small that all categories can be printed.

print.axes.val

Should the axes values be printed. Default prints each axis if rownames or colnames is not NULL.

print.x.axis.val

Should the x axis values be printed. Default prints each axis if rownames or colnames is not NULL.

print.y.axis.val

Should the y axis values be printed. Default prints each axis if rownames or colnames is not NULL.

x.axis.val.pos

x coordiante of the y axis values.

y.axis.val.pos

y coordiante of the x axis values.

cex.main

Size of the text in the main title.

cex.lab

Size of the text in matrix.

yaxis.line

The position of the y axis (the argument 'line').

xaxis.line

The position of the x axis (the argument 'line').

legend.left

How much left should the legend be from the matrix.

legend.up

How much up should the legend be from the matrix.

legend.size

Relative legend size.

legend.text.hor.pos

Horizontal position of the legend text (bottom) - 0 = bottom, 0.5 = middle,...

par.line.width

The width of the line that seperates the partitions.

par.line.col

The color of the line that seperates the partitions.

IM.dens

The densitiey of shading lines for each block.

IM

The image (as obtaind with critFunC) of the blockmodel. dens.leg is used to translate this image into IM.dens.

wnet

Specifies which matrix (if more) should be ploted - used if M is an array.

wIM

Specifies which IM (if more) should be used for ploting. The default value si set to wnet) - used if IM is an array.

use.IM

Specifies if IM should be used for plotting.

dens.leg

It is used to translate the IM into IM.dens.

blackdens

At which density should the values on dark colurs of lines be printed in white.

plotLines

Should the lines in the matrix be printed. The default value is set to FALSE, best set to TRUE for very small networks.

frameMatrix

Should the matrix be framed (if plotLines is FALSE). The default value is set to TRUE.

x0ParLine

Coordinates for lines seperating clusters.

x1ParLine

Coordinates for lines seperating clusters.

y0ParLine

Coordinates for lines seperating clusters.

y1ParLine

Coordinates for lines seperating clusters.

colByUnits

Coloring units units. It should be a vector of unit length.

colByRow

Coloring units by rows. It should be a vector of unit length.

colByCol

Coloring units by columns. It should be a vector of unit length.

mulCol

Multiply color when joining with row, column. Only used when when colByUnits is not NULL.

joinColOperator

Function to join colByRow and colByCol. The default value is set to "+".

colTies

If TRUE, ties are colored, if FALSE, 0-ties are colored.

maxValPlot

The value to use as maximum when computing colors (ties with maximal positive value are ploted as black).

printMultipliedMessage

Should the message '* all values in cells were multiplied by' be printed on the plot. The default value is set to TRUE.

replaceNAdiagWith0

If replaceNAdiagWith0 = TRUE Should the NA values on diagonal of a matrix be replaced with 0s

title.row

Title for the row-normalized matrix in nm version

title.col

Title for the column-normalized matrix in nm version

par.set

A list of possible ploting paramters (to par) to be used in nm version

which

Which (if there are more than one) of optimal solutions to plot.

...

Aditional arguments to plot.default for plot.mat and also to plot.mat for other functions.

Value

The functions are used for their side affect - plotting.

Author(s)

Ale? ?iberna

References

?IBERNA, Ale? (2006): Generalized Blockmodeling of Valued Networks. Social Networks, Jan. 2007, vol. 29, no. 1, 105-126. http://dx.doi.org/10.1016/j.socnet.2006.04.002.

?IBERNA, Ale?. Direct and indirect approaches to blockmodeling of valued networks in terms of regular equivalence. J. math. sociol., 2008, vol. 32, no. 1, 57-84. http://www.informaworld.com/smpp/content?content=10.1080/00222500701790207.

See Also

critFunC, optRandomParC

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
## Generation of the network
n <- 20
net <- matrix(NA, ncol = n, nrow = n)
clu <- rep(1:2, times = c(5, 15))
tclu <- table(clu)
net[clu == 1, clu == 1] <- rnorm(n = tclu[1] * tclu[1], mean = 0, sd = 1)
net[clu == 1, clu == 2] <- rnorm(n = tclu[1] * tclu[2], mean = 4, sd = 1)
net[clu == 2, clu == 1] <- rnorm(n = tclu[2] * tclu[1], mean = 0, sd = 1)
net[clu == 2, clu == 2] <- rnorm(n = tclu[2] * tclu[2], mean = 0, sd = 1)

## Ploting the network
plotMat(M = net, clu = clu, print.digits.cells = 3)
class(net) <- "mat"
plot(net, clu = clu)
## See corespodning functions for examples for other plotting
## functions
## presented, that are esentially only the wrappers for "plot.max"

blockmodelingOld documentation built on May 2, 2019, 5:11 p.m.