Set network layout options
layout(cytoscape, name = NULL, fit = TRUE, padding = 30, boundingBox = NULL, avoidOverlap = TRUE, avoidOverlapPadding = 10, nodeDimensionsIncludeLabels = FALSE, spacingFactor = NULL, condense = FALSE, rows = NULL, cols = NULL, position = NULL, sort = NULL, animate = FALSE, animationDuration = 500, animationEasing = NULL, animateFilter = NULL, ready = NULL, stop = NULL, transform = NULL, ...) # S3 method for cytoscape layout(cytoscape, name = NULL, fit = TRUE, padding = 30, boundingBox = NULL, avoidOverlap = TRUE, avoidOverlapPadding = 10, nodeDimensionsIncludeLabels = FALSE, spacingFactor = NULL, condense = FALSE, rows = NULL, cols = NULL, position = NULL, sort = NULL, animate = FALSE, animationDuration = 500, animationEasing = NULL, animateFilter = NULL, ready = NULL, stop = NULL, transform = NULL, ...)
cytoscape | object |
---|---|
name | character option, must b one of:
|
fit | boolean whether to fit the viewport to the graph |
padding | integer pixels padding used on fit |
boundingBox | = undefined, // constrain layout bounds; x1, y1, x2, y2 or x1, y1, w, h |
avoidOverlap | boolean prevents node overlap, may overflow boundingBox if not enough space |
avoidOverlapPadding | integer pixels extra spacing around nodes when avoidOverlap = true |
nodeDimensionsIncludeLabels | = false, // Excludes the label when calculating node bounding boxes for the layout algorithm |
spacingFactor | = undefined, // Applies a multiplicative factor (>0) to expand or compress the overall area that the nodes take up |
condense | boolean, uses all available space on false, uses minimal space on true |
rows | integer force num of rows in the grid |
cols | integer force num of columns in the grid |
position | js function( node ), // returns row, col for element |
sort | js a sorting function to order the nodes; e.g. function(a, b) return a.data('weight') - b.data('weight') |
animate | boolean whether to transition the node positions |
animationDuration | integer duration of animation in ms if enabled |
animationEasing | = undefined, // easing of animation if enabled |
animateFilter | = function ( node, i ) return true; , // a function that determines whether the node should be animated. All nodes animated by default on animate enabled. Non-animated nodes are positioned immediately when the layout starts |
ready | = undefined, // callback on layoutready |
stop | = undefined, // callback on layoutstop |
transform | = 'function (node, position ) return position; ' |
... | additional parameters passed to the layout object |
cytoscape object
df <- cytoscape::comtrade nodes <- data.frame(id = unique(c(df$reporter, df$partner))) edges <- df %>% dplyr::select(source = reporter, target = partner) %>% dplyr::mutate(id = paste(source, '_', target)) cytoscape(nodes = nodes, edges = edges) %>% cytoscape::layout(4)#> Error in layout.cytoscape(., 4): name %in% c("null", "random", "preset", "grid", "circle", "concentric", .... is not TRUE