mendeleev.vis.utils

Functions

add_tile_coordinates(df: DataFrame, x_coord: str = 'group_id', y_coord: str = 'period', include_f_block: bool = True, wide_layout: bool = False) DataFrame[source]

Calculate coordinates for the tile centers

Parameters:
  • df – dataframe

  • x_coord – attribute to use as x coordinate

  • y_coord – attribute to use as y coordinate

  • wide_layout – Show the long version of the periodic table with the f block between the s and d blocks

  • include_f_block – Show the elements from the f block

colormap_column(elements: DataFrame, column: str, cmap: str = 'RdBu_r', missing: str = '#ffffff')[source]

Return a new DataFrame with the same size (and index) as elements with a column cmap containing HEX color mapping from cmap colormap.

Parameters:
  • elements – DataFrame with the data

  • column – Name of the column to be color mapped

  • cmap – Name of the colormap, see matplotlib.org

  • missing – HEX color for the missing values (NaN or None)

create_vis_dataframe(x_coord: str = 'group_id', y_coord: str = 'period', include_f_block: bool = True, wide_layout: bool = False)[source]

Base DataFrame for visualizations

Parameters:
  • x_coord – attribute to use as x coordinate

  • y_coord – attribute to use as y coordinate

  • include_f_block – show the elements from the f block

  • wide_layout – show the long version of the periodic table with the f block between the s and d blocks