This function generates random data sets which can be used to make a hive plot.
ranHiveData(
type = "2D",
nx = 4,
nn = nx * 15,
ne = nx * 15,
rad = 1:100,
ns = c(0.5, 1, 1.5),
ew = 1:3,
nc = brewer.pal(5, "Set1"),
ec = brewer.pal(5, "Set1"),
axis.cols = brewer.pal(nx, "Set1"),
desc = NULL,
allow.same = FALSE,
verbose = FALSE
)
An object of S3 class HivePlotData
.
The type of hive plot to be generated. One of c("2D",
"3D")
.
An integer giving the number of axes to be created (2 =< nx
=< 6
).
An integer giving the number of nodes to be created. This is an initial number which may be reduced during clean up. See Details.
An integer giving the number of edges to be created. This is an initial number which may be reduced during clean up. See Details.
Numeric; a range of values that will be used as node radius values (the position of the node along the axis).
Numeric; a range of values that will be used as the node sizes.
Numeric; a range of values that will be used as the edge weights.
A vector of valid color names giving the node colors.
A vector of valid color names giving the edge colors.
A vector of valid color names to be used to color the axes;
length(axis.cols) must = nx
.
Character; a description of the data set.
Logical; indicates if edges may begin and end on the same
axis. Only applies to type = 2D
.
Logical; If TRUE
, the generation, processing and final
result is reported to the console.
If you create a very small data set with few nodes, there
may be no nodes assigned to some axes which will give an error when you try
to plot the data. It's up to the user to check for this possibility (you
can use sumHPD
).
Bryan A. Hanson, DePauw University. hanson@depauw.edu
For type = "2D"
, after the function creates an initial set of random
nodes, these are randomly chosen and connected between adjacent axes, so
that no edge crosses an axis.
For type = "3D"
, after the
function creates an initial set of random nodes and edges, these are cleaned
up by removing the following cases (which the rest of HiveR
is not
intended to handle at this time): duplicated nodes, nodes that are not part
of any edge, edges that begin and end on the same point, edges that begin
and end on the same axis, and finally, for nx = 5 or 6
, edges that
begin and end on colinear axes. Most of these don't cause an error, but
produce some ugly results.
For the arguments rad, ns, ew, nc
and ec
, the values given are sampled randomly (with replacement) and
assigned to particular nodes or edges.
test4 <- ranHiveData(nx = 4)
str(test4)
sumHPD(test4)
Run the code above in your browser using DataLab