# Query all current plot options
plot_options()
#> $node_style
#> $node_style$fill
#> [1] "white"
#>
#> $node_style$col
#> [1] "black"
#>
#> $node_style$lwd
#> [1] 1
#>
#> $node_style$padding
#> [1] 2
#>
#> $node_style$size
#> [1] 1
#>
#> $node_style$shape
#> [1] "circle"
#>
#>
#> $edge_style
#> $edge_style$col
#> [1] "black"
#>
#> $edge_style$lwd
#> [1] 1
#>
#> $edge_style$arrow_size
#> [1] 3
#>
#> $edge_style$circle_size
#> [1] 1.5
#>
#> $edge_style$gap
#> [1] 0
#>
#> $edge_style$label_col
#> [1] "black"
#>
#> $edge_style$label_fontsize
#> [1] 9
#>
#> $edge_style$label_shift
#> [1] 0.5
#>
#>
#> $label_style
#> $label_style$col
#> [1] "black"
#>
#> $label_style$fontsize
#> [1] 10
#>
#>
#> $title_style
#> $title_style$col
#> [1] "black"
#>
#> $title_style$fontsize
#> [1] 14
#>
#> $title_style$fontface
#> [1] "bold"
#>
#>
#> $spacing
#> [1] 1lines
# Query one option
plot_options("node_style")
#> $fill
#> [1] "white"
#>
#> $col
#> [1] "black"
#>
#> $lwd
#> [1] 1
#>
#> $padding
#> [1] 2
#>
#> $size
#> [1] 1
#>
#> $shape
#> [1] "circle"
# Drill into a nested option
plot_options("node_style", "fill")
#> [1] "white"
# Set a global default node fill
plot_options(node_style = list(fill = "lightblue"))
# Wider gaps between arranged plots
plot_options(spacing = grid::unit(3, "lines"))
# Set multiple defaults at once
plot_options(
node_style = list(fill = "lightblue", col = "navy"),
edge_style = list(col = "gray40", lwd = 1.5)
)
# Reset to defaults
plot_options(plot_default_options())

Get or set global default plot styles
Source: R/plot-options.R
Description
Configure the package-wide defaults for every plot: node_style, edge_style, label_style, and title_style, each a list of the fields taken by style_nodes(), style_edges(), style_labels(), and style_title(). The style verbs still override these defaults for the nodes and edges they select. spacing is the default gap (a grid unit) between plots arranged with cgraph_plot_grid(), | or /.
Usage
plot_options(...)Arguments
...
|
Named values to update options with (merged into the existing options via utils::modifyList(), so a partial style list only overrides the fields it mentions), or unnamed option names to retrieve. Multiple unnamed arguments drill down through nested options. Called with no arguments, returns all current plot options. Querying a non-existent option raises an error.
|
Value
When setting, the previous values for the updated options, invisibly. When getting, the requested options.
See Also
plot-styling for the style fields and per-plot styling, plot_default_options() to inspect or reset to the built-in defaults.
Other plotting: cgraph_grob(), cgraph_layout(), cgraph_plot(), cgraph_plot_grid(), plot-styling, plot_default_options()