As a rule in scientific education, at some point between starting undergraduate and doing professional research it would seem we are expected to simply start knowing how to do things, without necessarily any formal training. One example in my degree was writing code, but another, as it turns out, is drawing figures for papers. Today, I would like to assist with the latter!
Inkscape https://inkscape.org/ is free and very powerful. Paired with python plotting and the textext plugin https://github.com/textext/textext it can really handle a lot, from abstract concepts to technical diagrams to artistic illustrations. Here I’ll just describe the workflow for including LaTeX and plots generated in Matplotlib, the rest (the artsy bit) is more about playing around with the different tools to find an ideal workflow.
Installation on MacOS
(it should be easier for Windows/Linux)
- Install python https://www.python.org/downloads/macos/
- Install Inkscape
- Install brew
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" - Install pdflatex:
brew install mactex - Install TexText https://textext.github.io/textext/install/macos.html
To use Tex Text, see the documentation here: https://textext.github.io/textext/usage/gui.html
Most importantly you will need to update the Preamble file with any packages that you want to use, such as amsmath.
Plotting
For plotting with Matplotlib, the most important note is to save figures in vector format. This is achived simply with `plt.savefig(“filename.svg”,…). I also recommend setting the dpi=300 (this matters if the figure includes an image), since for high quality exports later 300 DPI is likely the highest resolution you’ll ever need. Prior to saving, plt.tight_layout() is a very convenient function to call especially if you are using subplots.
There are two ways to deal with plots in Inkscape: you can either insert as a file, or (and this is cool), as a reference to the file.
If you choose to insert the file, then because the plot was exported as a vector, it is fully editable in Inkscape. Press ‘N’ to enter the Node Tool and you’ll be able to select any part such as the axes, data, or labels, and change their styles using the Fill and Stroke tab on the right. You can also ungroup with cmd-shift-G to break the figure up into its constitutive parts. I often find myself ungrouping, editing then grouping again (cmd-G) though Inkscape does have an alternative workflow where if you right-click a group you can select Enter Group (the click anywhere outside the group to exit).
If you choose to reference the file, then the editing options are much more limited. However, you can make up for this by making changes to the matplotlib code to produce the figure in the final style desired. This is certainly the cleaner option and means if you update the analysis or data then the Inkscape figure will update automagically. In practice, I usually take the lazy way out and edit in Inkscape, but this means if you make changes to the analysis/data but want to keep the overall styling you need to redo it each time, so be warned.
General Tips
To draw an arbitrary shape, start with a rectangle (press R and drag it out), then convert it to a path using Path -> Object To Path. Then enter the node tool (press N) and you can drag the points, double click to add new ones. To make corners curved, you can hold down shift and drag from the point to add spline handles.
The align tool is your friend, and it works on nodes! For example, to draw an arrow:
- Draw a rectangle and convert to path as above
- Enter the node tool (N)
- Add a new node to three edges by double clicking the edges
- Still in the node tool, select the three nodes on the edge that is too become the point
- From the Align and Distribute tab (right, might need to click the arrow at the corner to open it), use the Distribute Nodes tool to align the nodes

6. Now the middle is perfectly centred, the sides can be deleted.
7. Add two more nodes to make the edges of the arrow, and again use the Distribute Nodes tool by selecting nodes that need to be aligned vertically / horizontally, or in the case of these 4 distributed horizontally

Blurs can make objects glow! Duplicate an object with cmd-D, then send to back from the top ribbon

Add some blur, and now you have a glowing object. Potentially do this a few times, with different blur amounts each time.

Exporting
Your inkscape masterpiece complete, it is time to export. From the Export tab, there are many options. For inserting into a LaTeX document such as an article, I set DPI=300 (this is very high) and change the export file type to PDF. LaTeX (eg using Overleaf) can very easily handle figures in PDF format using the includegraphics command, and it preserves most of the vector graphics (i.e. infinite zoom).
