| layout_modifier | R Documentation |
This is a constructor function for creating custom layout modifiers.
Layout modifiers can be used with layout_() to modify how layouts
are calculated or to transform the resulting coordinates.
layout_modifier(...)
... |
Named arguments that define the modifier. Must include:
|
An object of class igraph_layout_modifier.
layout_() for using modifiers, component_wise(), normalize()
for examples of built-in modifiers.
Other layout modifiers:
component_wise(),
normalize()
# Create a custom post-layout modifier that scales coordinates
scale_by <- function(factor) {
layout_modifier(
id = "scale_by",
type = "post",
args = list(factor = factor),
apply = function(graph, layout, modifier_args) {
layout * modifier_args$factor
}
)
}
# Use the custom modifier
g <- make_ring(10)
coords <- layout_(g, in_circle(), scale_by(2))
plot(g, layout = coords)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.