Diagrams

Of the kind I need, a practical guide to the creation thereof



On the art and science of scientific line drawings. I am especially interested in scientific diagrams; drafting/CAD/engineering stuff is different field again.

I am also interested in diagrams that are some mix of freehand and procedural; maybe partly generated algorithmically and partly through a GUI. This is obviously one of those combinations that you imagine would be useful but do not find often, like a billionaire media mogul who also believes in climate action.

Generally I would like these to export to a modern compatible vector format which means SVG, PDF or, as a fallback, one of these other formats that can be converted to the above, such as Adobe Illustrator, EPS or xfig.

I am no graphic designer, but I understand that it is a habit of successful scientists to have an effective Figure 1.

Awesome examples

Seeking inpiration? Gallery of concept visualisation: gallery of methods for explaining complex ideas; everything from exotic 3d stuff to crayon drawing and sticks. Construct your mood board!

See also interactive visualisations.

But how can I make awesome diagrams?

Personal opinion: it is a highly skilled discipline, graphic design, whixh I have not been trained for. But possibly I can make adequate diagrams rather than Terrible ones, while waiting on a graphic design budget.

Here’s the stack exchange list of tools

What follows is my list, in descending order of (fluctuating) frequency of use.

Notice there are few commercial entrants in this race? I’m too poor for any Autodesk product, and unconvinced of their utility unless I wish to build some kind of major concrete structure. I did buy Omnigraffle, the much-touted diagram editor for macOS. What a disaster; expensive, unintuitive, over-engineered. Like they ripped off xfig, took out the API and compensated for it by putting bezels on the icons. If you want to waste hours with horribly inscrutable drafting products, there are many open-source options available that can give you that experience for free.

My current recommendation: Start with diagrams.net and tidy up any mathematics etc in inkscape.

diagrams.net

diagrams.net (formerly draw.io) is a browser-based diagram editor. It is free and open source. It has all the modern convenience of the new generation of browser-based apps and the recent versions are pretty good; good enough that this is my go-to tool. I can use it as a desktop app or integrated browser widget:

This has a natural support also for the flowchart-style graphical model diagrams that I need a lot, and many other process-model diagrams, plus a little bit of generic diagramming. It can import Gliffy files.

Inkscape

Open source Inkscape can do everything; it is essentially targeting the Adobe Illustrator audience. Aimed firstly at general vector graphic design, which means the functions I want for sciencey stuff are not front-and-center, but it can be done.

In particular, Inkscape supports LaTeX math rendering in its PDF+LaTeX mode, which is extremely useful.

inkscape -D image.svg  -o image.pdf --export-latex

ipe

ipe has, if not a actually intuitive interface, at least one that makes certain specialist science graphing things easy. It’s mostly simple to learn, modulo some has oddities - e.g. you change the page size by creating and importing an XML stylesheet. Riiiight.

Also, it can’t export SVG, merely PDF and EPS, each of which are not so much vector graphics standards, as the battleground beneath the standards behind which the corporate armies clash.

Nonetheless, it repays persistence and can get some surprising qualitative diagrams done.

Ipe’s main features are:

  • Entry of text as LaTeX source code. This makes it easy to enter mathematical expressions, and to reuse the LaTeX-macros of the main document. …
  • Produces pure Postscript/PDF, including the text…
  • It is easy to align objects with respect to each other (for instance, to place a point on the intersection of two lines, or to draw a circle through three given points) using various snapping modes…

That last point sounds minor, but it is an ingenious move that makes all the more questionable design choices worthwhile. Anyone who has every spent 90 minutes on doing trigonometry to get a pstricks diagram right, and wondered what happened to the thing where computers eliminated drudge work, will weep upon the sight of it.

These days, diagrams.net has acquired many of the same alignment features and the point of differentiation is shrinking.

Has built-in Lua scripting, like everything on the planet. Integrates with matplotlib.

Recommended: handy user contributions by Stefan Huber.

See pdf2svg to export the PDFs to other formats.

Amie Wilkinson demonstrating that no computer at all can be pretty good still.

Figma

figma the browser-based graphic design tool might also be functional for diagrams. Its special selling point is that it is easy to collaboratively edit live. It is not particularly targeted at science but also it has lots of science-useful functionality. Not free, but many organisations have a corporate subscription.

Gliffy

Gliffy is an “enterprise” diagram tool whose selling point seems to be that it is integrated into lots of other enterprise things and works from the browser. AFAICT it is OK but it is hard to label things with mathematics, and the alignment is not quite as nice as diagrams.net. Not free, but many organisations have a corporate subscription.

Procedural graphics in my programming language of choice.

Python, R, julia, javascript all have diverse plotting infrastructure, some of which turns out to also be diagramming infrastructure.

Pencil

pencil is a fashionable tool for GUI design that happens to be good for some other tricky things, notably flow charts. It’s built as a browser app so has good compatibility with export and presumably some hackability. I have not looked at this one for a while; I wonder if it is still current.

Grammar of graphics

I am slightly interested in a certain kind of low-key automation which is sometimes useful in diagrams, which I understand is called a “compositional layout” diagramming style, as seen in Grammar-of-graphics tools, most famously R’s ggplot2. These tools lay out components as a kind of algebra of composed styling operations.

Compose.jl provides these for Julia. Diagrams is the Haskell version. R’s grid is purportedly somewhat similar for layout, as is all the ggplot2 stuff for style.

Dia

Dia has some neat features; and many confusing ones I can’t imagine the use-case for. Possibly this last one is because I am not in middle management. If you need to produce specialised diagram types for your project manager, Dia probably has the function.

Dia supports more than 30 different diagram types like flowcharts, network diagrams, database models. More than a thousand readymade objects help to draw professional diagrams. Dia can read and write a number of different raster and vector image formats. […] Dia can be scripted and extended using Python.

Crashes on my recent macOS, though, and I can’t be arsed working out why.

Asymptote

Asymptote

Asymptote is a powerful descriptive vector graphics language that provides a natural coordinate-based framework for technical drawing. Labels and equations are typeset with LaTeX, for high-quality PostScript output.

Might be good; haven’t used it. Has a jupyter extension

Boxy

An Inkscape alternative option leveraging web technology is Jarosław Foksa’s Boxy. Not sure if it has nay advantages over diagrams.net.

PlotDevice

PlotDevice is a cousin of nodebox, which is to say, a python drawing system 2d vector printable outputs.

PGFPlots

PGFPlots is a LaTeX-native diagramming/plotting package which supports PDF output. It is a less awful (although still unwieldy) successor to…

pstricks/tikz

The classic type-your-diagram-in-then-work-out-what-went-wrong option. I like the idea, but the practice, no. Elegant, powerful, and unless you happen to be doing exactly the right kind of diagram, tedious. Doesn’t support PDF output AFAICT.

latexdraw is a Java pstricks GUI. Might be good, but I couldn’t install it.

See also

TikZiT is a super simple GUI editor for graphs and string diagrams. Its native file format is a subset of PGF/TikZ, which means TikZiT files can be included directly in papers typeset using LaTeX.

xfig

xfig combines the imprecision of drawing through GUIs, with the abstruseness and fragility of drawing through code. Listed here for the surpassing beauty of its manual page.

Probabilistic graphical models

See diagramming graphical models.


No comments yet. Why not leave one?

GitHub-flavored Markdown & a sane subset of HTML is supported.