Visualizing custom periodic tables

In this tutorial you’ll how to use mendeleev to create customized visualizations of the periodic table.

The most convenient method to use for this is periodic_table function from mendeleev.vis module.

[1]:
from mendeleev.vis import periodic_table

Make sure you you have optional vis dependencies installed when installing mendeleev. If you are using pip install with

pip install mendeleev[vis]

To see the default visualization of the periodic table simply call the imported function

[2]:
periodic_table()

mendeleev stores also two color schemes for atoms that are frequently used for visualizing molecular structures. One set is stored in the cpk_color column and refers to CPK coloring, another is stored in jmol_color column and is used by the Jmol program, finally there is also coloring scheme from MOLCAS GV program store in the molcas_gv_color attribute. They can be displayed either by hovering of the element to display a tooltip or used directly to color the element cells.

[3]:
periodic_table(colorby="jmol_color", title="JMol Colors")
[4]:
periodic_table(colorby="cpk_color", title="CPK Colors")
[5]:
periodic_table(colorby="molcas_gv_color", title="MOLCAS GV Colors")

Visualizing properties

Any of the properties in mendeleev can now be visualized and color coded. This means that the value of selected attribute will be visible on each element and also it is possible to use the attribute to color code the background of each element.

Let’s first use the covalent_radius_pyykko and display the values with the default color coding by series

[6]:
periodic_table(attribute="covalent_radius_pyykko", title="Covalent Radii of Pyykko")

Now let’s use the same attribute but in addition color code by the actual values, by adding colorby='attribute' argument

[7]:
periodic_table(
    attribute="covalent_radius_pyykko",
    colorby="attribute",
    title="Covalent Radii of Pyykko",
)

The color map can aslo be csutomized using the cmap argument to any of the standard colormaps available in matplotlib

[8]:
periodic_table(
    attribute="covalent_radius_pyykko",
    colorby="attribute",
    cmap="spring",
    title="Covalent Radii of Pyykko",
)

Let also see one of the more modern colormaps: viridis, plasma, inferno and magma.

[9]:
periodic_table(
    attribute="covalent_radius_pyykko",
    colorby="attribute",
    cmap="inferno",
    title="Covalent Radii of Pyykko",
)

Lets try a different property: atomic_volume

[10]:
periodic_table(attribute="atomic_volume", colorby="attribute", title="Atomic Volume")
[11]:
periodic_table(
    attribute="en_pauling",
    colorby="attribute",
    title="Pauling's Electronegativity",
    cmap="viridis",
)

Wide 32-column version

The periodic_table function can also present the periodic table in the so-called wide format with the f-block between the s- and d-blocks resulting in 32 columns.

[12]:
periodic_table(height=600, width=1500, wide_layout=True)