Skip to contents

Class for managing visual themes for network plots.

Value

A CographTheme R6 object.

Active bindings

name

Theme name.

Methods


Method new()

Create a new CographTheme object.

Usage

CographTheme$new(
  name = "custom",
  background = "white",
  node_fill = "#4A90D9",
  node_border = "#2C5AA0",
  node_border_width = 1,
  edge_color = "gray50",
  edge_positive_color = "#2E7D32",
  edge_negative_color = "#C62828",
  edge_width = 1,
  label_color = "black",
  label_size = 10,
  title_color = "black",
  title_size = 14,
  legend_background = "white"
)

Arguments

name

Theme name (optional).

background

Background color.

node_fill

Default node fill color.

node_border

Default node border color.

node_border_width

Default node border width.

edge_color

Default edge color.

edge_positive_color

Color for positive edge weights.

edge_negative_color

Color for negative edge weights.

edge_width

Default edge width.

label_color

Default label color.

label_size

Default label size.

title_color

Title color.

title_size

Title size.

legend_background

Legend background color.

Returns

A new CographTheme object.


Method get()

Get a theme parameter.

Usage

CographTheme$get(name)

Arguments

name

Parameter name.

Returns

Parameter value, or NULL if the parameter is not set.


Method set()

Set a theme parameter.

Usage

CographTheme$set(name, value)

Arguments

name

Parameter name.

value

Parameter value.

Returns

The object itself, invisibly.


Method get_all()

Get all theme parameters.

Usage

CographTheme$get_all()

Returns

List of parameters.


Method merge()

Merge with another theme. Parameters in other replace the matching parameters of this theme; parameters present in only one of the two, including ones added with $set(), are kept.

Usage

CographTheme$merge(other)

Arguments

other

Another CographTheme or list of parameters.

Returns

A new CographTheme named "merged".


Method clone_theme()

Clone the theme. Parameters added with $set() are copied as well.

Usage

CographTheme$clone_theme()

Returns

A new CographTheme.


Method print()

Print theme summary.

Usage

CographTheme$print()

Returns

The object itself, invisibly.


Method clone()

The objects of this class are cloneable with this method.

Usage

CographTheme$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.

Examples

CographTheme$new(background = "white", node_fill = "steelblue")
#> CographTheme: custom 
#>   Background: white 
#>   Node fill: steelblue 
#>   Node border: #2C5AA0 
#>   Edge color: gray50 
#>   Edge positive: #2E7D32 
#>   Edge negative: #C62828