DaigrammeR background color

Is it possible to to change the background color from white to what I want?
The codes are:

library(DiagrammeR)

graph <-
  create_graph() %>%
  add_path(
    n = 3, 
    type = "step",
    label = c(
      "Experiment", "Feature Finding", "Statistical Analysis"
      ),
    node_aes = node_aes(  # set node aesthetics
      shape = c("rectangle", "rectangle", "rectangle"),
      width = c(1.5, 1.5, 1.5),
      color = "#3C3C3C",
      fontcolor = "black",
      fillcolor = c("#cbd20a", "#d3d3d3", "#d3d3d3"),
      fontname = "Lato" #Lato
    ), # "#61acf0" blue, "#cbd20a" yellow green, "#e74a2f" red
    edge_aes = edge_aes(  # set edge aesthetics
      color = "#3C3C3C"
    )
  ) %>%
  add_global_graph_attrs(attr = "layout", value = "dot", attr_type = "graph") %>%
  add_global_graph_attrs(attr = "rankdir", value = "TD", attr_type = "graph")


# View the graph in the Viewer
graph %>% render_graph()

Hi @lennylin,
Try adding this line:

  add_global_graph_attrs(attr = "bgcolor", value = "lightblue", attr_type = "graph")

This code shows you all the attributes that can be changed, and what their current settings are:

graph %>%
  get_global_graph_attr_info()
1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.