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 plotMatNm
plots two matrices based on M, normalized by rows and columns, next to each other. The plotArray
plots an array. plot.mat.nm
has been replaced by plotMatNm
.
# S3 method for critFun
plot(x, main = NULL, ...)# S3 method for crit.fun
plot(x, main = NULL, ...)
plotMatNm(
M = x,
x = M,
...,
main.title = NULL,
title.row = "Row normalized",
title.col = "Column normalized",
main.title.line = -2,
par.set = list(mfrow = c(1, 2))
)
# S3 method for optMorePar
plot(x, main = NULL, which = 1, ...)
# S3 method for opt.more.par
plot(x, main = NULL, which = 1, ...)
# S3 method for optMoreParMode
plot(x, main = NULL, which = 1, ...)
# S3 method for opt.more.par.mode
plot(x, main = NULL, which = 1, ...)
# S3 method for optPar
plot(x, main = NULL, which = 1, ...)
# S3 method for opt.par
plot(x, main = NULL, which = 1, ...)
# S3 method for optParMode
plot(x, main = NULL, which = 1, ...)
# S3 method for opt.par.mode
plot(x, main = NULL, which = 1, ...)
plotMat(
x = M,
clu = NULL,
orderClu = FALSE,
M = x,
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.width.newset="par.line.width[1]" *="" par.line.col="blue" par.line.col.newset="red" 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," collabels="FALSE," mplotvalues="NULL," ...="" )<="" p="">
plotArray(
x = M,
M = x,
IM = NULL,
...,
main.title = NULL,
main.title.line = -2,
mfrow = NULL
)
# S3 method for mat
plot(
x = M,
clu = NULL,
orderClu = FALSE,
M = x,
ylab = "",
xlab = "",
main = NULL,
print.val = !length(table(M))
=>
The functions are used for their side effect - plotting.
A result from a corresponding function or a matrix or similar object representing a network.
Main title.
Additional arguments to plot.default
for plotMat
and also to plotMat
for other functions.
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.
Main title in plotArray
version.
Title for the row-normalized matrix in nm version
Title for the column-normalized matrix in nm version
The line in which main title is printed in plotArray
version.
A list of possible plotting parameters (to par
) to be used in nm version
Which (if there are more than one) of optimal solutions to plot.
A partition. Each unique value represents one cluster. If the network is one-mode, then this should be a vector, else a list of vectors, one for each mode/set.
Should the partition be ordered before plotting. FALSE
by default. If TRUE
, orderClu
is used (using default arguments) to order the clusters in a partition in "decreasing" (see orderClu
for interpretation) order.
Label for y axis.
Label for x axis.
Should the values be printed in the matrix.
If print.val = TRUE
Should the 0s be printed in the matrix.
Should the legend for shades be plotted.
Should the values be printed in the legend.
The number of digits that should appear in the legend.
The number of digits that should appear in the cells (of the matrix and/or legend).
If not NULL
, the above argument is ignored, the cell values are printed as the cell are multiplied by this factor and rounded.
Should the title be printed on the 'inner' or 'outer' margin of the plot, default is 'inner' margin.
The line (from the top) where the title should be printed. The suitable values depend heavily on the displayed type.
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 ordinary plots is c(5, 4, 4, 2) + 0.1
, while this function default is c(0.5, 7, 8.5, 0) + 0.1
.
The size of the values printed. The default is 10 / 'number of units'
.
Correction for centering the values in the squares in y direction.
Correction for centering the values in the squares in x direction.
Size of the text in the legend.
The title of the legend.
Size of the characters in axes. Default makes the cex so small that all categories can be printed.
Should the axes values be printed. Default prints each axis if rownames
or colnames
is not NULL
.
Should the x axis values be printed. Default prints each axis if rownames
or colnames
is not NULL
.
Should the y axis values be printed. Default prints each axis if rownames
or colnames
is not NULL
.
The x coordinate of the y axis values.
The y coordinate of the x axis values.
Size of the text in the main title.
Size of the text in matrix.
The position of the y axis (the argument 'line').
The position of the x axis (the argument 'line').
How much left should the legend be from the matrix.
How much up should the legend be from the matrix.
Relative legend size.
Horizontal position of the legend text (bottom) - 0 = bottom, 0.5 = middle,...
The width of the line that separates the partitions.
The width of the line that separates that separates the sets/modes - only used when clu
is a list and par.line.width
has length 1.
The color of the line that separates the partitions.
The color of the line that separates that separates the sets/modes - only used when clu
is a list and par.line.col
has length 1.
The density of shading lines in each block.
The image (as obtained with critFunC
) of the blockmodel. dens.leg
is used to translate this image into IM.dens
.
Specifies which matrix (if more) should be plotted - used if M
is an array.
Specifies which IM
(if more) should be used for plotting. The default value is set to wnet
) - used if IM
is an array.
Specifies if IM
should be used for plotting.
It is used to translate the IM
into IM.dens
.
At which density should the values on dark colors of lines be printed in white.
Should the lines in the matrix be printed. The default value is set to FALSE
, best set to TRUE
for very small networks.
Should the matrix be framed (if plotLines
is FALSE
). The default value is set to TRUE
.
Coordinates for lines separating clusters.
Coordinates for lines separating clusters.
Coordinates for lines separating clusters.
Coordinates for lines separating clusters.
Coloring units. It should be a vector of unit length.
Coloring units by rows. It should be a vector of unit length.
Coloring units by columns. It should be a vector of unit length.
Multiply color when joining with row, column. Only used when when colByUnits
is not NULL
.
Function to join colByRow
and colByCol
. The default value is set to "+"
.
If TRUE
, ties are colored, if FALSE
, 0-ties are colored.
The value to use as a maximum when computing colors (ties with maximal positive value are plotted as black).
Should the message '* all values in cells were multiplied by' be printed on the plot. The default value is set to TRUE
.
If replaceNAdiagWith0 = TRUE
Should the NA
values on the diagonal of a matrix be replaced with 0s.
Should the labels of units be colored. If FALSE
, these are not colored, if TRUE
, they are colored with colors of clusters as defined by palette.
This can be also a vector of colors (or integers) for one-mode networks or a list of two such vectors for two-mode networks.
A matrix to strings to plot in cells. Only to be used if other values than those in the original matrix (x
or M
arguments) should be used. Defaults to NULL
, in which case the valued from original matrix are plotted (if this is not prevented by some other arguments). Overrides all other arguments that deal with cell values (e.g. print.digits.cells
). Sets print.val
to TRUE
and plot.legend
to FALSE
.
mfrow
Argument to par
- number of row and column plots to be plotted on one figure.
Aleš Žiberna
Žiberna, A. (2007). Generalized Blockmodeling of Valued Networks. Social Networks, 29(1), 105-126. doi: 10.1016/j.socnet.2006.04.002
Žiberna, A. (2008). Direct and indirect approaches to blockmodeling of valued networks in terms of regular equivalence. Journal of Mathematical Sociology, 32(1), 57-84. doi: 10.1080/00222500701790207
critFunC
, optRandomParC
# 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 corresponding functions for examples for other ploting
# functions
# presented, that are essentially only the wrappers for "plot.max"
Run the code above in your browser using DataLab