plot.cca: Plotting function for CCA modules.

plot.ccaR Documentation

Plotting function for CCA modules.

Description

Plot a CCA-produced module as a network diagram. The network nodes are survey variables (columns), and the ties are their correlations. Red (or dashed) ties represent negative correlations. This is a convenience function wrapping igraph's graphing functionality. Writing to a file is done via the Cairo package.

Usage

## S3 method for class 'cca'
plot(x, module.index, cutoff = 0.05, LAYOUT = igraph::layout.kamada.kawai, 
    drop.neg.ties.for.layout = TRUE, bw = FALSE, main = NULL, file = NULL, ...)

Arguments

x

The cca object returned by cca.

module.index

Index of module to plot, between 1 and length(x$modules).

cutoff

Minimum absolute column correlation to plot.

LAYOUT

If this is a function, it is assumed to be one of the layout routines from igraph (or something that returns data in the same format). Otherwise, it is assumed to be the layout returned by such a function.

drop.neg.ties.for.layout

Whether to drop negative ties for the purpose of layout. This may be necessary because some layout algorithms do not work if negative ties are present. Note that the negative ties are only dropped for the purposes of layout. They will still included in the actual plot.

bw

Whether to print in color for screen viewing (FALSE), or in b&w with dashed lines for negative ties for a journal manuscript (TRUE).

main

Caption at the top of the graph. If NULL, the module number is used as the caption.

file

If a filename is provided, the graph is saved as a pdf with that filename. Note that this requires the Cairo package.

...

Unused.

Value

If the LAYOUT paramter is a layout function, then the return value is the static layout generated by this function (this allows the same exact layout to be reproduced in the future–see example below). Otherwise, it is the same static layout that was passed to plot.cca.

Author(s)

Andrei Boutyline, andrei.boutyline@gmail.com

See Also

cca

Examples

    data(cca.example)
    res1 <- cca(cca.example) # with igraph 0.7, this should find 3 classes of sizes 218 391 144.
    plot(res1, 1) # plot the first module
    plot(res1, 2) # plot the second module
    plot(res1, 3) # plot the third module
    
    plot(res1, 1, bw = TRUE) # check out first module in black and white
    plot(res1, 1, LAYOUT = layout.fruchterman.reingold) # try a different layout algorithm
    
    # example of saving a fixed layout
    layout1 <- plot(res1, 1) # try out a layout ...
    layout1 <- plot(res1, 1) # ... try again
    layout1 <- plot(res1, 1) # ... until one looks good
	
	# Now plot the result with the chosen layout. To save image to disk, 
	# 	replace NULL below with file name (e.g., file = "module1.pdf")
	plot(res1, 1, LAYOUT = layout1, file = NULL)

corclass documentation built on Sept. 8, 2023, 5:50 p.m.