Adventures with diagram creation

As I concocted the Hamiltonian Cycle post, I admit to having faced certain frustration in rendering the necessary diagrams. Normally I try to refrain from diagrams or visuals of any sort in the types of posts I create. Consider it a personal philosophy.

In the past, given a degree of formality to a publication, I would inevitably arrive at the need for scientific visualizations. If sufficiently motivated, I would pour my energy into the task, considering the visualization almost a separate project in it’s own.

Likewise, I never established a systematic approach to diagram rendering, having a tendency to vary the toolkit depending on the circumstance. I suspect any particular approach could satisfy the needs, but never invested sufficient time in the training.

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


The plots tend to be the simpler of the cases. Given some data, visually display it in a plot. 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 various toolkits:

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 rendering some combination of boxes, ellipses or other polygons populated with text, possibly mathematically formatted, and cleverly connecting the shapes with lines or arrows. The figure may represent a graph, a tree, a mind map or a flow diagram, but in all cases the primitive elements consist of polygons, lines, text and particular formatting.

In this scenario the options tend to explode. As early as college, I used a fairly lightweight Dia diagramming open-source application available for all major platforms. Dia dates back to 1998, and still receives support 20 years later. 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 them 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 aspire 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 this 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 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 visuals.

All of the above programming frameworks render vector graphics, that is those that are scale invariant. 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 provides that capability. 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, 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 a culprit, not the solutions available.

Sources referenced

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