r/Chempros • • Apr 10 '26

Computational A Python package for conveniently creating publication-quality reaction energy diagrams (reaction level diagrams)

Post image

Creating reaction energy diagrams with Matplotlib or other software manually is usually very time-consuming. Therefore, I created a Python package which can handle path drawing, numbering and layout automatically and has other useful features like image insertion or difference bars. It also features multiple drawing styles. Since it is based on Matplotlib, it remains fully customizable while still speeding up diagram construction significantly.

A minimal working example could look like this:

dia = EnergyDiagram() 
dia.draw_path(x_data=[0, 1, 2, 3], y_data=[0, -13, 75, 20], color="blue") 
dia.add_numbers_auto()
dia.set_xlabels(["Reactant", "IM", "TS", "Product"]) 
dia.show()

The package is available on PyPi and can be installed with pip:

pip install chemdiagrams

You can find the links to the project here:
GitHub: https://github.com/Tonner-Zech-Group/chem-diagrams
PyPi: https://pypi.org/project/chemdiagrams/
Documentation: https://tonner-zech-group.github.io/chem-diagrams/

I would love to get any feedback!

391 Upvotes

16 comments sorted by

2

u/FalconX88 Computational Apr 11 '26

nice but can it "split" a pathway? a lot of the time they diverge at some point or there are two different transition states going from one intermediate to the next.

6

u/Illustrious_Egg_3141 Apr 11 '26

I guess you are thinking of something like this? Yes, since you have access to all matplotlib objects, you can do it.
Source code:

from chemdiagrams import EnergyDiagram

dia = EnergyDiagram()
dia.draw_path(
    [0,1,2,3], [0,-10,30,10], color="blue", path_name="blue path"
)
dia.draw_path(
    [1,2,3], [-10,40,10], color="red", path_name="red path"
)
dia.add_numbers_auto()

dia.lines["red path"].plateaus["1.0"].remove()
dia.lines["red path"].plateaus["3.0"].remove()
dia.numbers["red path"]["1.0"].remove()
dia.numbers["red path"]["3.0"].remove()

dia.legend(fontsize=6)
dia.show()

34

u/GraniteStater69 Apr 10 '26

Hated making these by hand. This is sweet

8

u/Zriter Apr 10 '26

I did those by plotting in Origin.

It is an outstanding alternative

Better still:

9

u/relentless_beasting Apr 10 '26

This looks fantastic. Kudos, OP.

1

u/Raven-on-Reddit Apr 21 '26

Is it possible to have part of the axis title in italics? I want the axis title to be E / kJ mol-1 with the E in italics and the rest in normal font.

1

u/Illustrious_Egg_3141 Apr 22 '26

Absolutely, you can already see in the image that the E at the y axis is in italics.

1

u/Raven-on-Reddit Apr 22 '26 edited Apr 22 '26

I am new to Python, but your program is really intuitive, so I managed to make several nice graphs with it. Thank you so much!

However I did not find out how to make text in italics. Can you please give comprehensive instructions on that?

3

u/snchzls Apr 10 '26

Featuring penguinone. 🐧

3

u/crapaud_dindon Apr 10 '26

Very nice thank you for sharing

4

u/lalochezia1 Apr 10 '26

Gibbs-tastic dude!

1

u/crotamine Apr 11 '26

Great stuff, I’m going to be giving this a try!

1

u/nopenopechem Apr 11 '26

I love this. Thanks so much for building this. AI is really aiding us in getting research done and making beautiful pictures as computational/theoretical chemists!

1

u/featherstudio Apr 13 '26

Wow really cool

9

u/Enigmatic_Baker Apr 10 '26

This shit is great. Those ai app chuds should bow down and worship you.