# Creating energy profile diagrams for publication

Is there automated software to create energy profile diagrams like the ones below?

One could use something like Illustrator or Inkscape, but they aren't automated, are expensive (Illustrator), are difficult to use, and wouldn't be practical for anything with more than a dozen energy levels. These diagrams don't look like they were hand-drawn, but I could be mistaken.

Ideally, it would be written in Python, but something in LaTeX or TikZ would be workable as well.

More specifically, I think this could be improved upon quite a bit.

• I think I recall from some chat session, that LordStryker was working on something like that, but it was in its early stages and I am not aware that he has published/released it. Other than that I have not yet come across something like that. I know that my coworkers draw them in Illustrator, I prefer inkscape. I guess one could cook up a solution in gnuplot, which is iirc able to produce various output formats. I personally prefer tables though and if really necessary dot-line diagrams. Still +1. Jan 9, 2016 at 18:50
• I've done a very crude one by hand in gnuplot before when attempting to make an MO diagram, but I was hoping for something more "automated" than that (though I would still prefer it to Inkscape, which I want to avoid learning). Anything similar I've just done in Keynote, which leaves me too reliant on a Mac. Jan 9, 2016 at 20:16
• I just found something in my link section that looks promising. Let me know if it helped. Nice Energy Level Diagrams with rxnlvl - wp.me/ptBY1-2W Jan 24, 2016 at 14:19
• If this isn't exactly what I was looking for, then I could definitely modify it to suit my own usage. Looks great, thanks! Jan 26, 2016 at 21:20
• Did you come up with something suitable and easy to use? Sep 5, 2016 at 8:04

# PyEnergyDiagrams

I use my own script. I have posted it on GitHub now. This is the final result:

It is quite easy to use, on the GitHub readme there is a small tutorial. You have to create an instance of ED class and then add the energy levels to it.

from energydiagram import ED
diagram = ED()


To add the links between the levels you can have a look to the IDs of the level using this the argument of the function plot show_IDs=True:

diagram.plot(show_IDs=True)


And then you can use:

 diagram.add_link(left_ID_levetobelinked,right_ID_levetobelinked)


# Export to pgf,pdf and svg

You can export it just saving the plot from the GUI button or programmatically in different formats for publications using matplotlib backend. I prefer to export the plot in .pgf and then I import it in the LaTeX document this allow a full control over fonts and appearance of the figure.

For reaching better quality you have to change a little bit the autogenerated .pgf file.

The first thing you have to do is to find and replace − with -.

Later you can follow the procedure in this answer so that the font of the figure matches with the font size and type of the document.

• Wow, that looks cool! Is it possible to export the image to svg or pdf, too? Jan 24, 2017 at 9:31
• @Martin-マーチン Yes, you can it's very easy. But if you use latex I would suggest to use pgf so you can modify your figure later on.
– G M
Jan 24, 2017 at 13:36
• I have no experience with pgf, and from Wikipedia I get that it is a bitmap file format. While I don't use LaTeX much anymore, I don't see how a bitmap would be superior to a vector image. But maybe this isn't the right place to discuss this. But I will certainly look into your script. Jan 24, 2017 at 13:46
• @Martin-マーチン nope that one is another kind of pgf. I am referring to en.wikipedia.org/wiki/PGF/TikZ
– G M
Jan 24, 2017 at 14:30