Attaches a palette to the object so every figure drawn from it uses the same
colours: sequence_plot, distribution_plot,
plot_state_frequencies and cograph::splot().
Usage
set_state_colors(x, colors)
# Default S3 method
set_state_colors(x, colors)
# S3 method for class 'netobject'
set_state_colors(x, colors)
# S3 method for class 'htna'
set_state_colors(x, colors)
# S3 method for class 'mcml'
set_state_colors(x, colors)
# S3 method for class 'netobject_group'
set_state_colors(x, colors)
state_colors(x) <- valueArguments
- x
A
netobject,netobject_group,mcmlorhtna.- colors
A named character vector of colours, e.g.
c(plan = "#0072B2", monitor = "#D55E00"). Names are states, and for anmcmlmay also be cluster names. Names the object does not carry are dropped with a message, so one project-wide palette can be attached to every object. States you do not name keep the default Okabe-Ito colour.NULLremoves a palette set earlier.- value
The palette, as for
colors, in the replacement formstate_colors(x) <- value.
Value
x, with the palette stored in x$state_colors and, for
an object carrying $nodes, mirrored into
x$meta$splot$defaults$node_fill in node order so
cograph::splot() honours it. The class is unchanged.
See also
state_colors to read the resolved palette back.
Examples
net <- build_network(group_regulation_long, method = "relative",
actor = "Actor", action = "Action", time = "Time")
net <- set_state_colors(net, c(plan = "#0072B2", monitor = "#D55E00"))
state_colors(net)
#> state color source
#> 1 adapt #E69F00 default
#> 2 cohesion #56B4E9 default
#> 3 consensus #009E73 default
#> 4 coregulate #F0E442 default
#> 5 discuss #CC79A7 default
#> 6 emotion #999999 default
#> 7 monitor #D55E00 set
#> 8 plan #0072B2 set
#> 9 synthesis #000000 default