0

I want to create a graph with nodes are labeled. However, when the node label is long, a node's interior is not filled even if I use style="filled"

Here is my code and output:

# Create an ndf with distinct labels and
# additional node attributes (where their classes
# will be inferred from the input vectors)
node_df <-
  create_node_df(
    n = 4,
    type = "a",
    label = c(23843333, 3333942, 836332, 21943333),
    style = "filled",
    color = "aqua",
    shape = c("circle", "circle",
              "rectangle", "rectangle"),
    value = c(3.5, 2.6, 9.4, 2.7))

# Display the node data frame
node_df
# }



# Create an edf with additional edge
# attributes (where their classes will
# be inferred from the input vectors)
edf <-
  create_edge_df(
    from = c(1, 2, 3, 4),
    to = c(4, 3, 1, 1),
    rel = "a",
    length = c(50, 100, 250, 100),
    color = "green",
    width = c(1, 5, 2, 3))

# Display the edge data frame
edf
# }

g <- create_graph(nodes_df = node_df, edges_df = edf)
render_graph(g)

Graph output

  • I do not understand your problem. In your graph, the nodes ___are___ filled with the color "aqua" just as you requested. What are you expecting to be different? – G5W Sep 14 '18 at 23:46
  • I was trying to find a way it automatically changes the font size so that the label can fit inside the node. –  Sep 18 '18 at 22:02

0 Answers0