Dear All,
I am currently working on using DiagrammeRsvg, I am trying to add an svg image inside the nodes within the graph.
Therefore, I please wanted to know, how I can add an image on a given node using using grViz function on DiagrammeRsvg.
The images should be pasted on nodes component (Comp)11 to Comp15 on the codes below.
Thank you in advance
A
''' r
#> install.packages("DiagrammeR")
library(DiagrammeR)
grViz("digraph flowchart {
# direction of flowchart left to right
graph[rankdir = LR, label= 'Study Design', fontsize= 32]
# Node definitions with substituted label text
node [fontname = Arial, shape = rectangle] # font type and frame type
# vist_id
Comp6 [label = 'Baseline', style = filled, style=filled]
Comp7 [label = '1 month', style = filled, style=filled]
Comp8 [label = '3 months', style = filled, style=filled]
Comp9 [label = '6 months', style = filled, style=filled]
Comp10 [label = '12 months', style = filled, style=filled]
# definition of all components of the flowchart, Comp= component
# visit number
Comp1 [label = 'Visit 1', shape = plaintext, style=filled]
Comp2 [label = 'Visit 2', shape = plaintext, style=filled]
Comp3 [label = 'Visit 3', shape = plaintext, style=filled]
Comp4 [label = 'Visit 4', shape = plaintext, style=filled]
Comp5 [label = 'Visit 5', shape = plaintext, style=filled]
Comp11 [style=filled] # vaccine image to be pasted on this node
Comp12 [style=filled] # # blood image to be pasted on this node
Comp13 [style=filled] # vaccine image to be pasted on this node
Comp14 [style=filled] # # blood image to be pasted on this node
Comp15 [style=filled] # # blood image to be pasted on this node
# Creates the relationship between the different components
Comp1 -> Comp2 -> Comp3 -> Comp4 -> Comp5;
Comp6 -> Comp7 -> Comp8 -> Comp9 -> Comp10;
Comp11 -> Comp12 -> Comp13 -> Comp14 -> Comp15
} # End of digraph function
# Enter content of the components
[1]: 'Vaccine' # vaccine image to be pasted on this node
[2]: 'Blood' # # blood image to be pasted on this node
[3]: 'Vaccine' # vaccine image to be pasted on this node
[4]: 'Blood' # # blood image to be pasted on this node
[5]: 'Blood' # # blood image to be pasted on this node
") # End of grViz command
<-
'''
related topic: # Illustrating nodes with emoji/image/icon? #295,