Description Usage Arguments Details Value Note Author(s) References See Also Examples
Objects of class audited
have embedded transaction tables
that can be retrieved as an object of class audit
using audit(x)
.
The plot
method for class audited
extracts the audit
table,
converts it to igraph
using as.igraph
, and plots it with the plot method
for class igraph
. For fine control of plotting characteristics, you can load igraph
and reproduce the sequence manually.
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 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 | ## S3 method for class 'audited'
plot(x,attrs=auditAttrs(x,...),...)
auditAttrs(x=NULL,...)
## S3 method for class 'audited'
auditAttrs(x,...)
## S3 method for class 'audit'
auditAttrs(
x,
inflation = 1,
proportion = 1,
canvas.nominal = 7,
dimension.nominal = 4,
chars.nominal = 6,
vertex.nominal = 30 * inflation,
vertex.aspect = 1.618,
canvas = min(dev.size()),
chars = max(chars.nominal,maxchar(x)),
dimension = max(nrow(x),2),
dimension.scale = dimension.nominal / dimension,
deconvolution = deconvolute(canvas,canvas.nominal),
modulation = modulate(dev.name()),
projection = project(canvas.nominal)/project(canvas),
distention = distend(max(dimension,2), 1.5 / dimension.nominal),
canvas.scale = canvas / canvas.nominal,
chars.scale = chars.nominal / chars,
edge.scale = dimension.scale * canvas.scale * projection,
vertex.scale = dimension.scale * deconvolution
* distention * projection * proportion * modulation,
vertex.label.scale = dimension.scale * canvas.scale
* distention * projection * proportion * chars.scale,
vertex.size = vertex.nominal * vertex.scale ^ scale,
vertex.size2 = vertex.size / vertex.aspect ^ scale,
vertex.label.cex = vertex.label.scale ^ scale,
edge.width = edge.scale ^ scale,
edge.arrow.size = edge.scale ^ scale,
edge.arrow.width = 1,
scale=TRUE,
rescale=!scale,
...
)
## Default S3 method:
auditAttrs(
x,
color = TRUE,
vertex.shape = 'circle',
vertex.size = 15,
vertex.size2 = vertex.size,
vertex.color = if (color) 'lightgreen' else NA,
vertex.frame.color = if (color) NA else 'black',
vertex.label.color = if (color) 'darkblue' else 'black',
vertex.label.cex = 1,
vertex.label.family = 'mono',
edge.color = if (color) 'darkgreen' else 'black',
edge.width = 1,
edge.arrow.size = 1,
edge.arrow.width = 1,
edge.label.color = vertex.label.color,
edge.label.cex = vertex.label.cex,
create.vertex.color = if (color) 'gold' else NA,
drop.vertex.color = if (color) 'pink' else NA,
drop.edge.color = if (color) 'red' else 'black',
drop.edge.label = if (color) NA else 'drop',
add.vertex.color = if (color) 'lightblue' else NA,
add.edge.color = if (color) 'blue' else 'black',
add.edge.label = if (color) NA else 'add',
merge.vertex.color = if (color) 'orchid' else NA,
merge.edge.color = if (color) 'orchid4' else 'black',
merge.edge.label = if (color) NA else 'merge',
transform.edge.label = if (color) NA else '',
modify.edge.label = if (color) NA else '',
rescale = FALSE,
...
)
## S3 method for class 'state'
format(x,format='\n%l\n%r',...)
|
x |
object of method dispatch |
inflation |
adjust vertex size relative to text size; default 1 |
proportion |
adjust vertex and text size relative to vertex spacing; default 1 |
format |
a format string for text of vertices; default: label over record count |
color |
logical: whether to use colorful defaults |
vertex.shape |
vertex shape; circle (default) and rectangle are well-supported |
vertex.color |
fill color |
vertex.frame.color |
frame color (default NA gives none) |
vertex.label.color |
vertex label color |
vertex.label.cex |
vertex label character expansion |
vertex.label.family |
vertex label family; default mono |
edge.label.color |
edge label default color |
edge.label.cex |
edge label cex |
edge.color |
default edge color |
create.vertex.color |
edge color for create events |
drop.vertex.color |
vertex color for drop events |
drop.edge.color |
edge color for drop events |
drop.edge.label |
edge label for drop events |
add.vertex.color |
vertex color for add events |
add.edge.color |
edge color for add events |
add.edge.label |
edge label for add events |
merge.vertex.color |
vertex color for merge events |
merge.edge.color |
edge color for merge events |
merge.edge.label |
edge label for merge events (see details) |
transform.edge.label |
edge label for transform events (see details) |
modify.edge.label |
edge label for modify events |
canvas.nominal |
reference canvas size |
dimension.nominal |
reference graph dimension |
chars.nominal |
reference label width in monospaced characters |
vertex.nominal |
reference vertex size |
vertex.aspect |
ratio of vertex size and vertex size2 |
canvas |
effective canvas size |
chars |
effective label width in monospaced characters |
dimension |
effective graph dimension |
dimension.scale |
dimension scale factor |
deconvolution |
size-specific adjustment of vertex size (for strict proportionality) |
modulation |
device-specific adjustment of vertex size |
distention |
dimension-specific adjustment of vertex size |
projection |
canvas-specific adjustment of vertex size |
canvas.scale |
canvas scale factor |
chars.scale |
label width scale factor |
edge.scale |
edge scale factor |
vertex.scale |
vertex scale factor |
vertex.label.scale |
vertex label scale factor |
vertex.size |
vertex size |
vertex.size2 |
vertex secondary size |
edge.width |
edge width |
edge.arrow.size |
edge arrow size |
edge.arrow.width |
edge arrow width |
scale |
logical: whether to apply scale factors (default TRUE) |
rescale |
logical: whether to use igraph-rescaling (default FALSE) |
attrs |
list; see details |
... |
passed to called functions |
An audited data frame x
has a default visualization by means of plot(x)
.
Labels and record counts are plotted in circles with colors that represent transaction types;
these are joined by arrows that represent transaction sequence. The option
color = FALSE
gives a black-and-white aesthetic with transaction types as
edge labels.
Default sizes are chosen to maintain a constant aesthetic regardless of transaction count,
label length, device, and (particularly) device size. Some effort is made to contain
the label text within the vertex, and to make the vertex size about .35 of the inter-vertex
distance. These can be adjusted with arguments inflation
and proportion
.
The format
argument controls how labels are displayed. It supports tokens
%l, %r, and %a, representing the vertex label (id), the integer number of
records, and the integer number of aggregates, respectively. By default, record
number is printed under the label, with a blank line above (which centers the
label portion in the vertex).
You should not usually need to be concerned with arguments other than inflation
,
proportion
, format
, and perhaps shape
. Since the plot is
implemented with the directed graph from igraph, additional arguments can
be specified in the form vertex.parameter
or edge.parameter
('parameter' not literal).
See igraph.plotting
for a full list. You can generate transaction-specific
parameters by prepending create
, add
, drop
, modify
,
transform
, merge
; for example merge.vertex.parameter
.
Set any parameter to NULL to defeat the defaults given above. Set attrs
to
list()
to defeat all defaults, giving igraph-native aesthetics.
Although most methods can be visualized as binary, several are inherently unary,
such as as.audited
, aggregate
, melt
, and cast
. These
have an operation type of modify
or transform
, and they store a hint
about the actual method name in arg.id
. The hint resurfaces as edge label
if the corresponding argument (modify.edge.label, transform.edge.label
) is
an empty string (default when color = FALSE
). Pass NULL
or NA
to suppress edge labels.
plot
: an invisible list of the effective (supplied) parameters; auditAttrs
: a list
The algorithms here try to emulate the aesthetics of a four-record transaction table
plotted with 6-character labels on a 7-inch pdf device. You are welcome
to experiment with dimension.nominal
, chars.nominal
, canvas.nominal
,
and vertex.nominal
.
Arrows and vertex frames (when printed) do not scale well for device sizes much less than 7 inches.
You can supply a device-specific adjustment by defining a method modulation.device
('device' not literal).
The function rstudiogd()
is an experimental convenience that defines modulation.RStudioGD
for
rapid prototyping that transfers well to pdf.
Dots arguments to plot.audited
are passed to as.igraph
but not
to plot
because plot.igraph
does not support unrecognized arguments.
For x with class path
('nm','audited','keyed','data.frame')
, consider plot(as.audited(x))
which
will demote to audited, and so give the audited rather than nm plotting behavior.
Tim Bergsma
http://metrumrg.googlecode.com,
http://en.wikipedia.org/wiki/Golden_rectangle (vertex.aspect
)
plot.igraph
igraph.plotting
as.keyed
as.audited
as.keyed.audited
audit
audited-package
Ops.audited
write.audit
subset.audited
melt.audited
1 |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.