R/zenplot.R
unfold.Rd
The 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.
The number of faces of the hypercube to unfold
A character
vector (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; if NULL
, the turns
are
constructed.
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 that n2dcols
is ignored if !is.null(turns)
.
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 method
is ignored if turns
are provided.
A logical
indicating whether the first one-dimensional (1d)
plot should be plotted.
A logical
indicating whether the last one-dimensional (1d)
plot should be plotted
A graphical parameter > 0 giving the width of 1d plots.
A graphical parameter > 0 giving the width of 2d plots.
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 list
having components
turns
: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 the occupancy
matrix 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 list
having components
orientations
: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 -- x
being the horizontal variable and y
the 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
, and top
) of the box which bound each of the
plots in order.
Although unfold()
is probably rather rarely used directly by a user,
it provides insight into how zenplots are constructed.
Other creating zenplots:
zenplot()
dim <- 20
unfolding <- unfold(nfaces = dim -1)
names(unfolding)
#> [1] "path" "layout"