DiagrammeR icon indicating copy to clipboard operation
DiagrammeR copied to clipboard

How can we add more than 9 footnotes in grViz?

Open DrMattG opened this issue 4 years ago • 1 comments

I have the same issue as @sachinjshah in a closed issue (198). Once you go over 9 footnotes the labels are recycled (i.e. label 10 is read as label 1). Can someone recommend a work around (my least preferred but currently only option is to make my graph simpler)

`library(DiagrammeR) grViz(" digraph a_nice_graph {

node definitions with substituted label text

node [fontname = Helvetica] x [label = '@@9', shape=triangle] a [label = '@@1', shape=box] b [label = '@@2'] c [label = '@@3', shape=box] d [label = '@@4'] e [label = '@@5', shape=box] f [label = '@@6'] g [label = '@@7'] h [label = '@@8'] i [label = '@@10'] j [label = '@@12'] k [label = '@@13']

edge definitions with the node IDs

x -> a x -> c x -> f a -> b c -> d c -> e f -> g g -> h

}

[1]: 'Emerging issues (e.g. novel diseases)' [2]: 'Horizon Scanning' [3]: 'Broad subject \n (e.g. agri-environment schemes as \ninterventions for conserving biodiversity) ' [4]: 'Scoping study \n (very similar to systematic map - \n often infers a more rapid approach)' [5]: 'Systematic map' [6]: 'Narrow subject \n (focused on few interventions with specific outcome measures \n e.g. What is the comparative effectiveness of field margin flower \n mixtures for enhancing pollinator abundance?' [7]: 'Systematic review' [8]: 'Meta-analysis' [9]: 'What is the subject \n of interest?' [10]: 'Decision context \n(often with various different types and \n qualities of evidence)' [12]: 'Expert opinion' [13]: 'Ancillory information which contextualises the decision \n e.g. budget constraints; conflicting poltical or social needs \n(e.g. a need to provide recreational access to protected areas)'
")`

Which gives this:

image

Originally posted by @DrMattG in https://github.com/rich-iannone/DiagrammeR/issues/198#issuecomment-634598578

DrMattG avatar May 27 '20 11:05 DrMattG

Labelling the "excess" nodes (i.e. the 10th node and up) directly in the node definition part works.

`grViz(" digraph a_nice_graph {

node definitions with substituted label text

node [fontname = Helvetica] x [label = '@@9', shape=triangle] a [label = '@@1', shape=box] b [label = '@@2'] c [label = '@@3', shape=box] d [label = '@@4'] e [label = '@@5', shape=box] f [label = '@@6'] g [label = '@@7'] h [label = '@@8'] i [label = 'Decision context \n(often with various different types and \n qualities of evidence)'] j [label = 'Expert opinion'] k [label = 'Ancillory information which contextualises the decision \n e.g. budget constraints; conflicting poltical or social needs \n(e.g. a need to provide recreational access to protected areas)']

edge definitions with the node IDs

x -> a x -> c x -> f a -> b c -> d c -> e f -> g g -> h

}

[1]: 'Emerging issues (e.g. novel diseases)' [2]: 'Horizon Scanning' [3]: 'Broad subject \n (e.g. agri-environment schemes as \ninterventions for conserving biodiversity) ' [4]: 'Scoping study \n (very similar to systematic map - \n often infers a more rapid approach)' [5]: 'Systematic map' [6]: 'Narrow subject \n (focused on few interventions with specific outcome measures \n e.g. What is the comparative effectiveness of field margin flower \n mixtures for enhancing pollinator abundance?' [7]: 'Systematic review' [8]: 'Meta-analysis' [9]: 'What is the subject \n of interest?' [10]: 'Decision context \n(often with various different types and \n qualities of evidence)'

")`

image

DrMattG avatar May 27 '20 11:05 DrMattG