
Unfold the hypercube and produce all information concerning the zenpath and zenplot layout
Source:R/zenplot.R
unfold.RdThe unfold() function imagines each pair of variables/dimensions
as a "face" of a high dimensional cube. These faces are "unfolded" from one 2d space
or "face" to the next about the 1d face or "edge" they share. The unfold()
function takes, as first argument, nfaces,
the number of 2d plots/spaces to be "unfolded" and produces the zenpath and
zenplot layout required for the function zenplot(). Laying out these pairs
with a zenplot is what is alluded to as an "unfolding" of (at least a part of)
the high dimensional space.
Arguments
- nfaces
The number of faces of the hypercube to unfold
- turns
A
charactervector (of length two times the number of variables to be plotted minus 1) consisting of"d","u","r"or"l"indicating the turns out of the current plot position; ifNULL, theturnsare constructed.- n2dcols
number of columns of 2d plots (\(\ge 1\)) or one of
"letter","square","A4","golden"or"legal"in which case a similar layout is constructed. Note thatn2dcolsis ignored if!is.null(turns).- method
The type of zigzag plot (a
character).Available are:
tidy:more tidied-up
double.zigzag(slightly more compact placement of plots towards the end).double.zigzag:zigzag plot in the form of a flipped “S”. Along this path, the plots are placed in the form of an “S” which is rotated counterclockwise by 90 degrees.
single.zigzag:zigzag plot in the form of a flipped “S”.
rectangular:plots that fill the page from left to right and top to bottom. This is useful (and most compact) for plots that do not share an axis.
Note that
methodis ignored ifturnsare provided.- first1d
A
logicalindicating whether the first one-dimensional (1d) plot should be plotted.- last1d
A
logicalindicating whether the last one-dimensional (1d) plot should be plotted- width1d
A graphical parameter > 0 giving the width of 1d plots.
- width2d
A graphical parameter > 0 giving the width of 2d plots.
Value
A list describing the unfolded path and its layout
as a list of named components:
path:the path of the unfolding, itself given as a structured
listhaving componentsturns:the sequence of turns – each being one of “l” (for left), “r” (for right), “d” (for down), and “u” (for up) – required to move from the current plot location in the display to the next along the unfolded path.
positions:the path as a matrix of
(x, y)positions giving the indices in theoccupancymatrix of each plot in the path.occupancy:A rectangular array whose cells indicate the positions of the plots on the page.
layout:the details of the visual layout of the plots and given as a structured
listhaving componentsorientations:a vector indicating the orientation of each of the displays in order – “h” for horizontal, “v” for vertical, and “s” for square.
dimensions:a vector giving the dimensionality of each plot in order.
vars:A matrix of the variable indices to be used in each plot –
xbeing the horizontal variable andythe vertical.layoutWidth:A positive integer giving the display width of a 2d plot.
layoutHeight:A positive integer giving the display height of a 2d plot.
boundingBoxes:A matrix of 4 columns giving locations (
left,right,bottom, andtop) of the box which bound each of the plots in order.
Note
Although unfold() is probably rather rarely used directly by a user,
it provides insight into how zenplots are constructed.
See also
Other creating zenplots:
zenplot()
Examples
dim <- 20
unfolding <- unfold(nfaces = dim -1)
names(unfolding)
#> [1] "path" "layout"