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

This function will take an adjacency graph and convert it into a basic
`HivePlotData`

object. Further manipulation by
`mineHPD`

will almost certainly be required before the data can
be plotted.

1 |

`M` |
A matrix with named dimensions. The names should be the node names. Should not be symmetric. If it is, only the lower triangle is used and a message is given. |

`axis.cols` |
A character vector giving the colors desired for the axes. |

`type` |
One of |

`desc` |
Character. A description of the data set. |

`...` |
Other parameters to be passed downstream. |

This function produces a "bare bones" `HivePlotData`

object. The names
of the dimensions of `M`

are used as the node names. All nodes are
given size 1, an id number (`1:number of nodes`

), are colored black and
are assigned to axis 1. The edges are all gray, and the weight is M[i,j].
The user will likely have to manually make some changes to the resulting
`HivePlotData`

object before plotting. Alternatively,
`mineHPD`

may be able to extract some information buried in the
data, but even then, the user will probably need to make some adjustments.
See the examples.

A ` HivePlotData`

object.

Bryan A. Hanson, DePauw University. hanson@depauw.edu Vesna Memisevic contributed a fix that limited this function to bipartite networks (changed in v. 0.2-12).

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 | ```
### Example 1: a bipartite network
### Note: this first example has questionable scientific value!
### The purpose is to show how to troubleshoot and
### manipulate a HivePlotData object.
require(bipartite)
data(Safariland) # This is a bipartite network
# You may wish to do ?Safariland or ?Safari for background
hive1 <- adj2HPD(Safariland, desc = "Safariland data set from bipartite")
sumHPD(hive1)
# Note that all nodes are one axis with radius 1. Process further:
hive2 <- mineHPD(hive1, option = "rad <- tot.edge.count")
sumHPD(hive2)
# All nodes still on 1 axis but degree has been used to set radius
# Process further:
hive3 <- mineHPD(hive2, option = "axis <- source.man.sink")
sumHPD(hive3, chk.all = TRUE)
# Note that mineHPD is generating some warnings, telling us
# that the first 9 nodes were not assigned to an axis. Direct
# inspection of the data shows that these nodes are insects
# that did not visit any of the flowers in this particular study.
# Pretty up a few things, then plot:
hive3$edges$weight <- sqrt(hive3$edges$weight) * 0.5
hive3$nodes$size <- 0.5
plotHive(hive3)
# This is a one-sided hive plot of 2 axes, which results
# from the curvature of the splines. We can manually fix
# this by reversing the ends of edges as follows:
for (n in seq(1, length(hive3$edges$id1), by = 2)) {
a <- hive3$edges$id1[n]
b <- hive3$edges$id2[n]
hive3$edges$id1[n] <- b
hive3$edges$id2[n] <- a
}
plotHive(hive3)
### Example 2, a simple random adjacency matrix
set.seed(31)
nr <- 20
nc <- 15
M <- matrix(floor(runif(nc * nr, 0, 10)), ncol = nc)
colnames(M) <- sample(c(letters, LETTERS), nc, replace = FALSE)
rownames(M) <- sample(c(letters, LETTERS), nr, replace = FALSE)
hive4 <- adj2HPD(M)
sumHPD(hive4)
``` |

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.