Advanced visulization tutorial

mendeleev support two interactive plotting backends

  1. Plotly (default)

  2. Bokeh

Note

Depending on your environment being the classic jupyter notebook or jupyterlab you might have to do additional configuration steps, so if you’re not getting expected results see plotly of bokeh documentation.

Accessing lower level plotting functions

There are two plotting functions for each of the backends:

  • periodic_table_plotly in mendeleev.vis.plotly

  • periodic_table_bokeh in mendeleev.vis.bokeh

that you can use to customize the visualizations even further.

Both functions take the same keyword arguments as the periodic_table function but the also require a DataFrame with periodic table data. You can get the default data using the create_vis_dataframe function. Let’s start with an example using the plotly backend.

[1]:
from mendeleev.vis import create_vis_dataframe, periodic_table_plotly
[2]:
elements = create_vis_dataframe()
periodic_table_plotly(elements)
/home/docs/checkouts/readthedocs.org/user_builds/mendeleev/envs/stable/lib/python3.8/site-packages/mendeleev/vis/utils.py:34: FutureWarning: In a future version, `df.iloc[:, i] = newvals` will attempt to set the values inplace instead of always setting a new array. To retain the old behavior, use either `df[df.columns[i]] = newvals` or, if columns are non-unique, `df.isetitem(i, newvals)`
  elements.loc[elements[y_coord].notnull(), "y"] = elements.loc[