Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Editing the labels on a flow chart with DiagrammeR to have bullet points and bold text #449

Open
GabriellaS-K opened this issue Nov 23, 2021 · 1 comment

Comments

@GabriellaS-K
Copy link

Thanks for an awesome package!
I’m trying to make a flow chart with R. Attached is the chart I made in word (which is what I'm trying to get to). I don’t want to copy and paste it, I want to actually make it in R. I’ve been using DiagrammeR to try, and the code is below. I'm having the main trouble with the labels, how to change some parts to bold and make them a nice distance away from the nodes. I've added in the blue and pink boxes in my code, which I like. I've asked this question in stack overflow, but no luck.

Thanks!
Screenshot 2021-11-23 at 12 01 23


library(DiagrammeR)
graph <- "
digraph boxes_and_circles{

# Add node statements
# This states that all following nodes have a box shape
   node[
   shape=box,
   style=rounded,
   fontname=Helvetica,
   penwidth=2,
   fixedsize = true
   width=4
   ]


# Connect the nodes with edge statements
  edge[
  arrowhead = normal,
  arrowtail = none
  ]
  
# These are the main nodes at top of graph
  '@@1'->'@@2'
  [label='   Cleaning Function: 
Text to lower case
Contractions expanded
Numbers replaced
Abbreviations expanded (Qdap)
NA’s ignored
Kerns replaced
White space removed', fontname=Helvetica, fontsize=20, fontweight=bold]

  '@@2'->'@@3'
  '@@2'->'@@4'
  


# Make subnodes with boxes around for tidy text grouping
# graph, node, and edge definitions
  graph [
  compound = true,
  nodesep = 1,
  ranksep = 0.25,
  color = pink
  ]

# subgraph for tidy text, direct the flow
  subgraph cluster0 {
 '@@3'->'@@5' 
 [label=' -Tokenization
  -Lemetisation
    -Stop words removed', fontname=Helvetica, fontsize=20, fontweight=bold]
  }

# Make subnodes with boxes around for Dictionary grouping
# graph, node, and edge definitions
  graph [
  compound = true, 
  nodesep = 1, 
  ranksep = .25,
  color = blue
  ]

# subgraph for Dictionary direct the flow
  subgraph cluster1 { 
  node [
  fixedsize = true, 
  width = 3
  ]
  '@@4'->'@@6' [label='   Scoring function (sentimentr)
Inner Join (dplyr)',fontname=Helvetica]
  '@@6'->'@@7' [label='   Grouping
Summarise (dplyr)',fontname=Helvetica]
  '@@7'->'@@8' 
  }


 #Add a graph statement to change the properties of the graph
 graph[nodesep=1] #this modifies distance between nodes

 }

# Name the nodes
  [1]: 'Response Data'
  [2]: 'Clean Data'
  [3]: 'Tidy Text'
  [4]: 'Dictionary Creation'
  [5]: 'Visualisation'
  [6]: 'Sentiment Lexicon'
  [7]: 'Summarised Text'
  [8]: 'Visualisation and Statistics'

"
@QVJD
Copy link

QVJD commented May 3, 2022

Up

I ask myself exactly the same questions : bullet points and bold text

Please, need help

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants