Set/retrieve graphical parameters of a netplot object
Usage
set_gpar(x, type, element, idx, ...)
set_edge_gpar(x, element, idx, ...)
set_vertex_gpar(x, element, idx, ...)
get_vertex_gpar(x, element, ..., idx)
get_edge_gpar(x, element, ..., idx)
get_gpar(x, type, element, ..., idx, simplify = TRUE)Arguments
- x
An object of class
netplot.- type
Character. Either
"edge"or"vertex".- element
Character. If
"edge", then it can be either"line"or"arrow", otherwise it can be either"core"or"frame".- idx
(optional) Integer vector. Indices of the elements to be modified. When missing, all elements are modified.
- ...
Parameters to be modified/retrieved. This is passed to grid::editGrob via grid::gpar.
- simplify
Logical. When
TRUEit tries to simplify the result. Otherwise it returns a nested list.
Details
set_edge_gpar and set_vertex_gpar are shorthands for
set_gpar(type = "edge", ...) and set_gpar(type = "vertex", ...)
respectively.
get_edge_gpar and get_vertex_gpar are shorthands for
get_gpar(type = "edge", ...) and get_gpar(type = "vertex", ...)
respectively.
Examples
library(igraph)
library(netplot)
x <- make_ring(5)
g <- nplot(x)
# Updating edge color
g <- set_edge_gpar(g, col = "gray80")
# Retrieving the color of the vertices (core)
get_vertex_gpar(g, element = "core", "fill", "lwd")
#> $fill
#> [1] "#4B0055" "#4B0055" "#4B0055" "#4B0055" "#4B0055"
#>
#> $lwd
#> [1] NA NA NA NA NA
#>