janosh/pymatviz

A toolkit for visualizations in materials informatics.

What it solves

pymatviz tackles the challenge of visualizing complex materials science data. Researchers often need to create periodic table heatmaps, phonon band structures, crystal structure views, XRD patterns, and more. This toolkit provides a unified Python library to generate these interactive plots quickly and consistently.

How it works

pymatviz is a Python package built on Plotly, making all charts interactive. It includes modules for periodic table plots (heatmaps, histograms, scatter plots, split heatmaps), phonon bands and densities of states, combined band+DOS figures, 2D and 3D crystal structure rendering, Brillouin zones for different crystal systems, XRD patterns, radial distribution functions, and coordination environment histograms. It also offers composition clustering with multiple embedding methods (one-hot, Magpie, Matscholar, MEGNet) and dimensionality reduction techniques (PCA, t-SNE, UMAP, Isomap, Kernel PCA). Additionally, pymatviz provides interactive widgets for structures, compositions, and trajectories via anywidget and MatterViz, usable in Jupyter, Marimo, and VSCode notebooks. These widgets support exporting to standalone HTML or images and can produce machine-readable descriptors and render reports.

Who it’s for

pymatviz is aimed at researchers, data scientists, and engineers in materials informatics, materials science, and computational chemistry. It suits anyone who uses Python and tools like pymatgen or ASE and needs flexible, interactive visualizations for exploration, analysis, and communication of materials data.

Highlights

  • Interactive periodic table heatmaps, histograms, scatter plots, and split heatmaps powered by Plotly
  • Phonon band structure and density-of-states plotting, including combined figures
  • 2D and 3D crystal structure visualization
  • Interactive widgets for structure, composition, and trajectory data in Jupyter, Marimo, and VSCode
  • Export widgets to standalone HTML, PNG/JPEG/SVG/PDF, and headless render health checks
  • Composition clustering using one-hot, Magpie, Matscholar, and MEGNet embeddings with PCA, t-SNE, UMAP, Isomap, and Kernel PCA
  • 3D Brillouin zone plotting for cubic, hexagonal, monoclinic, and orthorhombic cells
  • XRD pattern plotting for single or multiple patterns, with horizontal or vertical stacking
  • Element pair radial distribution functions for crystal and amorphous structures
  • Coordination environment histograms

Related

  • Project
  • Project
  • Project
  • Project
  • Project