Questions tagged [diagrammer]

DiagrammeR is a R package for creating diagrams.

DiagrammeR is a R package for creating graph diagrams using text in a Markdown-like syntax. Mermaid (.mmd) or Graphviz (.gv) files can be edited directly within the IDE for .

Graphviz attributes allow you to style your Graphviz graph. Combinations of attributes for nodes, edges, clusters, and for the entire graph provide for highly-customized layouts.

All Graphviz attributes are specified by name-value pairs. Thus, to set the fillcolor of a node abc, one would use

abc [fillcolor = red] Similarly, to set the arrowhead style of an edge abc -> def, one would use

abc -> def [arrowhead = diamond] Quotation marks are important only for multiword attributes, such might be used in the label attribute.

enter image description here

Features The Graphviz layout programs take descriptions of graphs in a simple text language, and make diagrams in useful formats, such as images and SVG for web pages; PDF or Postscript for inclusion in other documents; or display in an interactive graph browser. Graphviz has many useful features for concrete diagrams, such as options for colors, fonts, tabular node layouts, line styles, hyperlinks, and custom shapes.

Roadmap dot - "hierarchical" or layered drawings of directed graphs. This is the default tool to use if edges have directionality.

neato - "spring model'' layouts. This is the default tool to use if the graph is not too large (about 100 nodes) and you don't know anything else about it. Neato attempts to minimize a global energy function, which is equivalent to statistical multi-dimensional scaling.

fdp - "spring model'' layouts similar to those of neato, but does this by reducing forces rather than working with energy.

sfdp - multiscale version of fdp for the layout of large graphs.

twopi - radial layouts, after Graham Wills 97. Nodes are placed on concentric circles depending their distance from a given root node.

circo - circular layout, after Six and Tollis 99, Kauffman and Wiese 02. This is suitable for certain diagrams of multiple cyclic structures, such as certain telecommunications networks.

Links:

207 questions
3
votes
3 answers

How to rearrange diagram in R

I updated my diagrammer to version 0.9.0 and started rendering different diagram from the same data. My data frame now looks like this: df <- data.frame(col1 = c( "Cat", "Dog", "Bird"), col2 = c( "Feline", "Canis", "Avis"), …
Deividas Kiznis
  • 431
  • 1
  • 6
  • 20
3
votes
1 answer

Justify node text in DiagrammeR

Does anybody know if DiagrammeR currently supports left- and right-justification of node labels when using GraphViz? Here is a quick example, where I would like to left-justify the text within both of the nodes: library(DiagrammeR) grViz(" digraph…
Derek Damron
  • 338
  • 3
  • 9
3
votes
1 answer

why does grViz plot a different graph each time? How can I freeze it?

I'm using the grViz function from the DiagrammeR package, and I have defined a graph. My problem is that each time I plot it, I get a different arrangement. for example, you will get a different plot each time you run the codes below. Is there a…
Mostafa Rezaei
  • 599
  • 5
  • 9
2
votes
0 answers

How to increase the arrow lengths between nodes for DiagrammeR?

supposed I have a diagram like this. library("DiagrammeR") niv <- c("A","B","C","D","E","X","Y") from <- c("A","A","A","A","B","C","D","E", "X", "B") to <- c("B","C","D","E","X","X","Y","Y","Y", "C") temp <- data.table(from=factor(from,…
Ahdee
  • 4,679
  • 4
  • 34
  • 58
2
votes
0 answers

Converting grViz objects to DiagrammeR objects

The function DiagrammeR::grViz() produces an object of class "grViz" and "htmlwidget". Unfortunately, most functions in DiagrammeR assume your graph is a drg_graph object and so you cannot simply pass the output of grViz to those functions. Is there…
socialscientist
  • 3,759
  • 5
  • 23
  • 58
2
votes
0 answers

DiagrammeR - Digraph flowchart - Position and direction of labels on arrows

I am making a flowchart using DiagrammeR. I managed to make the nods and label the arrows, but I'd like to be able to decide if the arrow labels will be on the right or left of the arrow. Also, I'd like the arrows to hve diagonal direction,…
2
votes
1 answer

Mermaid Flowchart does not render 'longer arrows'

--- title: "Markdown Demo" author: "J" date: "6/14/2021" output: html_document --- ## Setup ```{r setup, include=FALSE} knitr::opts_chunk$set(echo = TRUE) library(DiagrammeR) ``` ## R Markdown ```{r} mermaid(" graph TB; a ==> b; b…
2
votes
0 answers

Decrease the distance between nodes in the last-to-date DiagrammeR version (1.0.6.1)

I would like to decrease the distance between nodes in DiagrammeR R package. I am aware that is a similar question here: How to increase distance between nodes in DiagrammeR R. However, such a solution is not working in the current DiagrammeR…
user3091668
  • 2,230
  • 6
  • 25
  • 42
2
votes
1 answer

How to change node shapes and labels of a data.tree in a shiny app

First post so hopefully I've remembered to include everything and have used the right terminology! A while ago I used data.tree to create a diagram showing the relationships between animals in a herd. The diagram includes info in addition to the…
2
votes
1 answer

Print DiagrammeR object inside for-loop

Is there a straightforward way to print DiagrammeR objects from within a loop in an R Markdown document? I have a document in which a regression table, a plot and a diagram are each generated for multiple models and printed together. It's easy to do…
Omar Wasow
  • 1,870
  • 24
  • 24
2
votes
2 answers

Adjust edge label position in mediation diagram with DiagrammeR?

I am trying to draw a standard triangular mediation diagram using DiagrammeR in R (it can also interpret graphviz code). On the whole, it's working fine but the edge label text gets placed oddly. The bottom edge label is not centered and the two…
Omar Wasow
  • 1,870
  • 24
  • 24
2
votes
0 answers

Line Breaks in Aligned Text When Using HTML Tables in DiagrammeR Nodes

I am looking for help in aligning text within HTML tables inside of DiagrammeR nodes. In this working example: library(DiagrammeR) grViz( "digraph consort_diagram { graph[splines = ortho] node [fontname = Helvetica, shape = box] …
Ben
  • 28,684
  • 5
  • 23
  • 45
2
votes
1 answer

Error with R version 4.0.2 but not in R version 3.6.3 with DiagrammR: ! LaTeX Error: Environment grViz undefined

I have successfully used grViz in DiagrammR with an R markdown (bookdown) file on R version 3.6.3 that causes an error on another computer with R version 4.0.2. I have "tried everything" that I could think of including re-installing TinyTex and…
jys
  • 121
  • 7
2
votes
1 answer

weight attribute of edges not working on `DiagrammeR` R package

I am trying to add some edge attributes to a GraphViz graph using the DiagrammeR package in R. In particular, I want to add the attributes arrowhead and weight, but only the former is added to the graph but not the latter. The example below is not…
2
votes
2 answers

R diagrammeR using html for formatting while reading text from r variable

I'm creating a flow chart with the R package diagrammer. To get desired formatting (bold, bullet, left-justify) I can write node label in html. However, I also want to populate some of the text by calling variables in R, and I can't figure out how…
Alton
  • 137
  • 6