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
40
votes
2 answers

DiagrammeR mermaid: inconsistent results in rmarkdown ioslides

I have a rmarkdown presentation (ioslides) with 3 slides with flow diagrams worked in DiagrammeR's mermaid. The following file saved as .Rmd can reproduce the example (at least in my machine, hopefully yours too): --- title: "Untitled" author:…
PavoDive
  • 6,322
  • 2
  • 29
  • 55
14
votes
4 answers

How to export images of diagrammer in R

I'm trying create image of diagrammer graph but it creates blank files instead. My data frame: df <- data.frame(col1 = c( "Cat", "Dog", "Bird"), col2 = c( "Feline", "Canis", "Avis"), stringsAsFactors=FALSE) The…
Deividas Kiznis
  • 431
  • 1
  • 6
  • 20
13
votes
1 answer

How can I have more than 4 section colours in mermaid (Gantt) via DiagrammeR?

I will have to generate a gantt diagram in a daily basis. My idea is to use the mermaid api included in R's DiagrammeR package. My data will always have the same structure and, therefore, I have created a quite primitive parser that is included in…
Jon Nagra
  • 1,538
  • 1
  • 16
  • 36
11
votes
3 answers

Drawing manually on a figure

I have generated a graph: library(DiagrammeR) grViz(" digraph boxes_and_circles { # a 'graph' statement graph [layout = neato, overlap = true, fontsize = 10, outputorder = edgesfirst] # several 'node' statements node [shape = circle, …
histelheim
  • 4,938
  • 6
  • 33
  • 63
10
votes
1 answer

How to create a entity relation diagram (ERD)

Does anyone know of a simple and easy method for creating entity relation diagrams (ERD) in R besides graphviz and/or DiagrammeR. I don't use graphviz much and often take more time than I'd like remembering it's syntax just to create a simple…
code_cowboy
  • 596
  • 5
  • 18
10
votes
1 answer

How to include DiagrammeR/mermaid flowchart in a Rmarkdown file

I have an R markdown file: --- title: "Untitled" author: "Me" output: html_document --- ```{r setup, include=FALSE} knitr::opts_chunk$set(echo = TRUE) ``` ## R Markdown This is an R Markdown document. As well as a DiagrammeR/mermaid chart: graph…
Oneira
  • 1,365
  • 1
  • 14
  • 28
9
votes
1 answer

Using DiagrammeR in Word document (generated using rMarkdown)

I've been looking at the diagrammeR package (http://rich-iannone.github.io/DiagrammeR/) to generate diagrams in rMarkdown. This works great when rendering the documents in HTML; now the question I have is whether there is a possibility to output the…
PMaier
  • 592
  • 7
  • 19
8
votes
0 answers

DiagrammeR export_graph Invalid asm.js

I'm having a problem exporting graphs in R to PDFs using DiagrammeR's export_graph function in RStudio. Example below to reproduce the problem. The PDFs are produced inconsistently so sometimes not at all. The error message I get is on calling the…
8
votes
1 answer

mermaid diagrams: Adjust white space around graph

I'm using mermaid diagrams in my Rmd reports compiled with Rstudio. In the HTML/PDF output, there is a lot of blank space above and below the charts, see example below. # Header Text ```{r} library(DiagrammeR) mermaid(" graph TD classDef…
mavericks
  • 1,005
  • 17
  • 42
8
votes
2 answers

DiagrammeR: Adjust font size within node

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 <-…
Joachim Schork
  • 2,025
  • 3
  • 25
  • 48
7
votes
1 answer

Diagrammer: how to add labels to mermaid connectors

I am trying R DiagrammeR library, and can noT add a label for the connectors between boxes... My code (which works fine) is: library(DiagrammeR) mermaid(" graph TD A[node 1]-->B[node 2] A-->C[node 3] C-->E[another node] …
COLO
  • 1,024
  • 16
  • 28
6
votes
1 answer

Alpha for fill color in DiagrammR

I am trying to use the node attribute 'alpha' in a grViz but I can't get it to work (in RStudio) using R3.5.1 and all packages updated. This code produces no alpha. library(DiagrammeR) grViz(" digraph { node [fontname = Helvetica, shape =…
arnyeinstein
  • 669
  • 1
  • 5
  • 14
6
votes
2 answers

Creating an organizational chart in R

I need to draw an organizational chart of the company in R. I have an example but I would like the arrows to leave the same point. What I expect (from PowerPoint): What I got (in R): Code: grViz(" digraph { graph[splines=ortho, nodesep=1] …
Andre Luiz
  • 61
  • 1
  • 2
6
votes
1 answer

add text to DiagrammeR flowchart flowline in R

The following code creates a flowchart in R with the DiagrammeR package. How can I add "Yes" or "No" (or any other text) to the flowlines connecting the shapes? When creating charts, my nodes will often be decisions, and I'd like to label the…
stackinator
  • 5,429
  • 8
  • 43
  • 84
6
votes
0 answers

How to save DiagrammeR Gantt graph as svg file

I would like to know how to save a Gantt diagram that was generated with the mermaid function of DiagrammeR as an SVG file. Take as example the following Gantt diagram from this post: Gantt charts with…
Yatrosin
  • 341
  • 2
  • 15
1
2 3
13 14