Adventures with diagram creation

2019-03-17 @Technology

Normally I try to refrain from diagrams or visuals throughout my writings. Consider it a personal philosophy. However, when the the need does arise, the process generates certain frustration.

In the past as I more often produced formal writeups, I would inevitably arrive at a need for scientific visualizations. If sufficiently motivated, I would pour my energy into the task, considering the visualization almost a separate project.

Likewise, I never established a systematic approach to the rendering of diagrams. The methodology tends to vary depending on the circumstance. I suspect any particular approach could satisfy the needs, but never invested sufficient time into the training.

Notwithstanding, there are two categories of diagrams I encounter - the plots and, well, everything else consisting of graphs, boxes, flows, schematics, etc…

Plots

The plots tend to be the simpler of the cases. Given some data of small dimensionality, visually render it.

Unless faced with data beyond three dimensions, the procedure is fairly straightforward. Import the data into your favorite plotting package or API, configure your axes, labels, colors, plot style and whatnot, and render the visual. In the past I’ve used varying tools:

One may also generate plots in R, Julia, Lisp, or other scientific packages. Alternatively, the non-programming inclined may resort to traditional spreadsheets.

Other diagrams

Generally, the exercise involves the rendering of some combination of boxes, ellipses or other polygons populated with text, possibly with mathematical formatting. These shapes must then cleverly connect with lines or arrows.

The figure may represent a graph, a tree, a mind map or a flow diagram, but each case involves the same primitive geometrical shapes with text and some particular formatting.

In this scenario the number of options tends to explode. As early as college, I used a fairly lightweight Dia diagramming open-source solution available for all major platforms. Dia dates back to 1998, and still receives support 20 years after. It supports all basic as well as hundreds of custom shapes characteristic of proprietary schematics, circuits, flows, automata, etc. It also enables you to connect the objects via smart or specific connection points, and drag the shapes around as the connectors follow.

Dia also exports to a vector graphic or any other popular format. It does not support native mathematical formatting of text, but you can circumvent this limitation as Dia allows an export to a Latex TikZ figure.

To this day I resort to Dia anytime I stumble upon a too frustrating case of diagramming, despite my best intent towards a more elaborate solution.

I occasionally come to render visuals in Asymptote. Asymptote is not a graphical, but a programming-oriented visualization framework written in C. The Asymptote syntax itself is an augmented variety of C featuring primitive datatypes for shapes, paths, lines, etc, beyond the C fundamentals.

Without heavily elaborating, one must invest the time in the sizable learning curve to see the increased efficiency. Since I don’t create diagrams that often, I never reached such a point. Each attempt requires much effort to render even primitive elements, although something in the process I find more gratifying than interfacing with visual tools.

The Latex TikZ package also features an impressive framework and packages for diagram creation by means of programming, albeit in a far different syntax. I too leveraged it in the past, whenever already in the scope of a Latex scientific document. The benefits and challenges are similar to those of Asymptote.

Both Asymptote and TikZ, however, facilitate certain types of diagrams more than others. You’ll find packages/libraries for rendering mind-maps, mathematical tree structures, fractals, circuits, automata, and other proprietary types of schematics.

All of the above programming frameworks render scale-invariant vector graphics. The graphical options below, work similarly. It’s simply a matter of preference.

Inkscape is a graphical visualization framework specializing entirely in vector graphics. If one aspires to create vector-graphical works of art, Inkscape’s the way to go.

For simpler diagrams, I’m not certain to the viability of this approach. I suspect it to be another case of a steep learning curve, better suited for the more graphically motivated.

I also discovered draw.io, which provides both a cloud-based and an offline client. I’ve only experimented with the cloud solution, but it impressed me with how rapidly I succeeded at connecting and arranging the primitive shapes within only minutes of learning.

All of the above solutions are available for all major platforms.

Sometimes I wish for a quicker method to render visualizations. But I’m probably more of the culprit, not the solutions available.

Sources referenced

  1. gnuplot
  2. Latex TikZ and PGF
  3. Python matplotlib
  4. Dia
  5. Asymptote
  6. Inkscape
  7. draw.io

Questions, comments? Connect.