Learn R Programming

HiveR (version 0.2-16)

plotHive: Create a hive plot (2D or 3D)

Description

These functions plot a HivePlotData object in either 2D or 3D, depending upon which function is called.

Usage

plotHive(HPD, ch = 1, method = "abs", dr.nodes = TRUE, bkgnd = "black",
	axLabs = NULL, axLab.pos = NULL, axLab.gpar = NULL,
	anNodes = NULL, anNode.gpar = NULL,
	arrow = NULL, np = TRUE, ...)

plot3dHive(HPD, ch = 1, dr.nodes = TRUE, method = "abs", axLabs = NULL, axLab.pos = NULL, LA = FALSE, ...)

Arguments

HPD
An object of S3 class HivePlotData.
ch
Numeric; the size of the central hole in the hive plot.
method
Character. Passed to manipAxis (see there for allowed values).
dr.nodes
Logical; if TRUE nodes will be drawn.
bkgnd
Any valid color specification. Used for the background color for plotHive.
axLabs
A vector of character strings for the axis labels.
axLab.pos
Numeric; An offset from the end of the axis for label placement. Either a single value or a vector of values. If a single value, all labels are offset the same amount. If a vector of values, there should be a value for each axis. This allows flexibili
axLab.gpar
(Applies to plotHive only) A list of name - value pairs acceptable to gpar. These control the label and arrow displays. See the examples. Note that if you use this argument the default color fo
anNodes
(Applies to plotHive only) The path to a csv file containing information for labeling nodes. If present, a line segment will be drawn from the node to the specified text. The text is positioned near the end of a radial vector. The columns
anNode.gpar
(Applies to plotHive only) A list of name - value pairs acceptable to gpar for use with plotHive only. These control both the text used to annotate the nodes and the line segments co
np
(Applies to plotHive only) Logical; should a new device (page) be opened when drawing the hive plot? If you are making multiple plots within some sort of grid manipulations (e.g. a hive plot per the vignette) then this should be
arrow
(Applies to plotHive only) A vector of 5 or 6 values: a character string to label the arrow, and 4 numeric values giving the angle of the arrow, the radius at which to start the arrow, the radius at which to end the arrow, and a value to offs
LA
Logical: should splines be drawn with line_antialias = TRUE? Only applies to plot3dHive.
...
Additional parameters to be passed downstream.

Value

  • None. Side effect is a plot.

Details

plotHive uses grid graphics to produce a 2D hive plot in a style similar to the original concept. For a 2D plot, axis number 1 is vertical except in the case of 2 axes. plot3dHive produces a 3D hive plot using rgl graphics. For most work with plot3dHive, use LA = FALSE for speed of drawing. LA = TRUE is over 20 times slower, and is more appropriate for high quality hive plots. These are probably better made with R CMD BATCH script.R rather than interactive use. Using anNodes gives a lot of flexibility to positioning annotation text, but it may take quite a few iterations if you are perfectionistics. Prepare to be patient if you plan to label quite a few nodes. I suggest beginning with offset, hjust and vjust set to 0. There may be some changes to this in the near future.

References

http://academic.depauw.edu/~hanson/HiveR/HiveR.html

Examples

Run this code
test2 <- ranHiveData(nx = 2)
test3 <- ranHiveData(nx = 3)
test4 <- ranHiveData(nx = 4, type = "3D")
#
# plot one with defaults:
plotHive(test3)
#
# Add axis labels & options to nx = 3 example.  Note that rot is not part of gpar
require("grid")
plotHive(test3, ch = 5, labs = c("axis 1", "axis 2", "axis 3"),
lab.pos = c(10, 15, 15), lab.gpar = gpar(col = "orange", fontsize = 14),
rot = c(0, 30, -30))
#
# Now the nx = 2 case.
# Note that gpar contains parameters that apply to both the
# axis labels and arrow. A 6th value in arrow offsets the arrow vertically:
plotHive(test2, ch = 5, labs = c("axis 1", "axis 2"), rot = c(-90, 90),
lab.pos = c(20, 20), lab.gpar = gpar(col = "pink", fontsize = 14, lwd = 2),
arrow = c("radius units", 0, 20, 60, 25, 40))

# The following must be run interactively:
plot3dHive(test4)

Run the code above in your browser using DataLab