r/learnpython • • 2h ago

Any advice for plotting an Atomic orbital energy diagram?

The subreddit doesn't let me attach an image so this is a vague rendition of what it looks like.

My current idea is using horizontal bar charts with matplotlib.pyplot, but it doesn't have an x-axis and I'm struggling to create the y axis.

3 Upvotes

5 comments sorted by

2

u/michUP33 1h ago

1

u/Joltik2007 1h ago

Not quite. It's the right topic, but that's plotting the shape of the orbital which is above and beyond what I need. I just need the energy levels.

•

u/Langdon_St_Ives 14m ago

This plots actual orbitals. OP wants energy levels.

1

u/hiriel 1h ago

Maybe a bit more complicated example than you need but here: https://anyplot.ai/energy-level-atomic/python/matplotlib The important bit is plotting the horizontal lines as straight lines between two points with the same y coords, and show only the y axis.

•

u/FontanJanneice18 57m ago

are you trying to generate these dynamically from calculated values, or just making a few static figures for a paper? If its static, drawing raw line segments and text annotations on a blank canvas is much less painful than forcing a chart type to fit.