File: density_plot.py

package info (click to toggle)
python-periodictable 2.0.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 3,068 kB
  • sloc: python: 13,338; makefile: 103; sh: 92; javascript: 7
file content (17 lines) | stat: -rw-r--r-- 473 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import matplotlib.pyplot as plt
import periodictable

params = {'figure.figsize': (10,8)}
plt.rcParams.update(params)

D = [(el.number,el.density,el.symbol)
    for el in periodictable.elements]

bbox = dict(boxstyle="round",lw=1,ec=(0,0,0),fc=(0.85,0.8,0.8))
for Z,density,sym in D:
    if density is not None:
        plt.text(Z,density,sym,bbox=bbox)
plt.axis([0,110,0,25])
plt.xlabel('Element number')
plt.ylabel('Density of element')
plt.title('Density for elements')