I want to create a flowchart with the DiagrammeR
Package in R
. Within some nodes, I want to reduce the font size of some parts of the text.
Consider the following example in R
:
library("DiagrammeR")
# Create a node data frame (ndf)
ndf <- create_node_df(n = 4,label = c("aaa", "bbb",
"Same size\nThese letters\nshould be smaller",
"ccc"))
# Create an edge data frame (edf)
edf <- create_edge_df(from = c(1, 2, 3, 3),
to = c(4, 3, 1, 4))
# Create a graph with the ndf and edf
graph <- create_graph(nodes_df = ndf,
edges_df = edf)
# Print graph
graph %>%
render_graph()
The font size of the node in the middle should partly be reduced. The text "Same size" should be kept as it is. The font size of the text "These letters should be smaller" should be reduced.
Question: How could I adjust the font size for some parts of the text within a node?
Try
fixedsize = FALSE
.
This adjusts the node to stretch to fit the words. It's documented here under Create_nodes
but they really do not explain it very well.
The behavior to me was Fixedsize=True
(in that no matter what we put in it.. the size was fixed).
So I've tried fixedsize = FALSE
and it worked!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With