Recommendations for which package to use for a complicated plot

I am trying to create a figure that looks more or less like the following (taken from J. Zhang et al., Corrosion Science 144 (2018) 44–53):

Could I get recommendations for a plotting package (preferably in Julia, but I’m open to anything that would take me less than an hour to install) that could make something like this? Particularly with the arrows and subscripts for the chemical names? The only thing I can think of off the top of my head is matplotlib/PyPlot, or perhaps to add the arrows myself (I’m ok enough with GIMP that I could probably do it) but was wondering if there might be an easier way.

You can add arrows and text as annotations in PyPlot. There are plenty of examples on matplotlib.org

(use inkscape for vector graphics)

I was kind of afraid when I asked the question that this was the answer. I could do it manually in Inkscape too but if I had to change something about the figure it would be much easier to have a script to edit rather than start all over from scratch.

That is why you should do it in PyPlot, rather than manually . You can calculate the coordinates of the text and arrows in your script and pass that to PyPlot.

I won’t say you should do it in PyPlot. Any selfrespecting plotting package in julia could do this (see the visualization tab here https://julialang.org/). But yes, it is one of the packages that are available to do this - and to me it looks like it might have been made with pyplot originally.

1 Like

Fair point. I’m just a little biased… :smile:

I actually tried to look at the docs for both Gr.jl and Plotly.jl to see where I could find how to position arbitrary arrows in the plot, because I like their default appearance much more than I like matplotlib (that’s the main reason I said above “I was afraid matplotlib was the answer”). I found nothing. If anyone could point me to the relevant documentation for it I’d be grateful.

In my experience, the amount of time it’s taken to figure out how to get annotations in plots looking how I wanted — regardless of the package or language — has vastly outweighed the cost of just manually hacking it up in Illustrator by a significant factor. Sure, it stinks to re-generate the graphic, but with judicious use of layers it’s not horrible. Perhaps that’s just my skill-set bias. At the same time, though, I hate it. It goes against every impulse I have for reproducibility, automation, and laziness.

What’s gotten me closest in the past is PGF/Tikz, but it’s been a while since I’ve used those tools.

3 Likes

Using PGFPlotsX with directly embedded LaTeX usually gets me what I want in a single pass directly from Julia. This usually involves from web search for the right LaTeX/TikZ construct, but makes it easy to regenerate the plot if the data changes.