Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

set_gpar

Set/retrieve graphical parameters of a netplot object


Description

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 TRUE it 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.

Value

An object of class netplot with modified parameters.

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")

netplot

Beautiful Graph Drawing

v0.1-1
MIT + file LICENSE
Authors
George Vega Yon [aut, cre] (<https://orcid.org/0000-0002-3171-0844>)
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.