Data Science Desktop Survival Guide
by Graham Williams |
|||||
Adding a Flowchart |
Raw LaTeX and R both support extensive capability for generating pictures. Here we use the diagram package to draw a flow chart, something that is a common requirement in documentation. The simple example shows the process of converting a .Rnw file using knitr to a LaTeX file which can then be processed by pdflatex to generate the .pdf file. The result can be seen in Figure 22.2.
# Load package from the local library into the R session.
library(diagram) # Identify some names for the nodes of the flowchart. names <- c(".Rnw", ".tex", ".pdf") # Set up the connectivity data. connect <- c(0, 0, 0, "knitr", 0, 0, 0, "pdflatex", 0) # Constract a connectivity matrix and plot the flowchart. matrix(nrow=3, ncol=3, byrow=TRUE, data=connect) %>% plotmat(pos=c(1, 2), name=names, box.col="orange")
There are many more possibilities provided by diagram and if interested you can explore demo(plotmat) and demo(plotweb).
|