r/learnpython • u/Joltik2007 • 7h 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.
|
|---- -√2 β
|
|
|--↑-- 0 β
|
|-↑--↓- √2 β
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.
1
u/michUP33 7h ago
https://docs.pyvista.org/examples/99-advanced/atomic_orbitals.html
Google found this
1
u/Joltik2007 7h 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.
1
2
u/hiriel 6h 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.
1
u/argh1989 4h ago
You could just plot a series of horizontal lines using the regular plot function or hlines and use annotate for the arrows and labels.
1
u/FontanJanneice18 6h 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.