• Stars
    star
    152
  • Rank 243,736 (Top 5 %)
  • Language
    Python
  • License
    MIT License
  • Created over 3 years ago
  • Updated about 1 month ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A toolkit for visualizations in materials informatics.

Logo
pymatviz

A toolkit for visualizations in materials informatics.

Tests This project supports Python 3.9+ PyPI PyPI Downloads Zenodo

If you use pymatviz in your research, see how to cite.

Installation

pip install pymatviz

API Docs

See the /api page.

Usage

See the Jupyter notebooks under examples/ for how to use pymatviz. PRs with additional examples are welcome! ๐Ÿ™

matbench_dielectric_eda.ipynb Open in Google Colab Launch Codespace
mp_bimodal_e_form.ipynb Open in Google Colab Launch Codespace
matbench_perovskites_eda.ipynb Open in Google Colab Launch Codespace
mprester_ptable.ipynb Open in Google Colab Launch Codespace

Periodic Table

See pymatviz/ptable.py. Heatmaps of the periodic table can be plotted both with matplotlib and plotly. plotly supports displaying additional data on hover or full interactivity through Dash.

ptable_heatmap(compositions, log=True) ptable_heatmap_ratio(comps_a, comps_b)
ptable-heatmap ptable-heatmap-ratio
ptable_heatmap_plotly(atomic_masses) ptable_heatmap_plotly(compositions, log=True)
ptable-heatmap-plotly-more-hover-data ptable-heatmap-plotly-log
ptable_hists(data, colormap="coolwarm" ptable_scatters(data, colormap="coolwarm"
ptable-hists ptable-scatters

Phonons

See pymatviz/phonons.py.

plot_phonon_bands(bands_dict) plot_phonon_dos(doses_dict)
phonon-bands phonon-dos
plot_phonon_bands_and_dos(bands_dict, doses_dict)
phonon-bands-and-dos

Dash app using ptable_heatmap_plotly()

See examples/mprester_ptable.ipynb.

2022-07-28-ptable_heatmap_plotly-dash-example.mp4

Sunburst

See pymatviz/sunburst.py.

spacegroup_sunburst([65, 134, 225, ...]) spacegroup_sunburst(["C2/m", "P-43m", "Fm-3m", ...])
spg-num-sunburst spg-symbol-sunburst

Sankey

See pymatviz/sankey.py.

sankey_from_2_df_cols(df_perovskites) sankey_from_2_df_cols(df_rand_ints)
sankey-spglib-vs-aflow-spacegroups sankey-from-2-df-cols-randints

Structure

See pymatviz/structure_viz.py. Currently structure plotting is only supported with matplotlib in 2d. 3d interactive plots (probably with plotly) are on the road map.

plot_structure_2d(mp_19017) plot_structure_2d(mp_12712)
struct-2d-mp-19017-Li4Mn0.8Fe1.6P4C1.6O16-disordered struct-2d-mp-12712-Hf9Zr9Pd24-disordered

matbench-phonons-structures-2d

Histograms

See pymatviz/histograms.py.

spacegroup_hist([65, 134, 225, ...], backend="matplotlib") spacegroup_hist(["C2/m", "P-43m", "Fm-3m", ...], backend="matplotlib")
spg-num-hist-matplotlib spg-symbol-hist-matplotlib
spacegroup_hist([65, 134, 225, ...], backend="plotly") spacegroup_hist(["C2/m", "P-43m", "Fm-3m", ...], backend="plotly")
spg-num-hist-plotly spg-symbol-hist-plotly
elements_hist(compositions, log=True, bar_values='count')
elements-hist

Parity Plots

See pymatviz/parity.py.

density_scatter(xs, ys, ...) density_scatter_with_hist(xs, ys, ...)
density-scatter density-scatter-with-hist
density_hexbin(xs, ys, ...) density_hexbin_with_hist(xs, ys, ...)
density-hexbin density-hexbin-with-hist
scatter_with_err_bar(xs, ys, yerr, ...) residual_vs_actual(y_true, y_pred, ...)
scatter-with-err-bar residual-vs-actual

Uncertainty

See pymatviz/uncertainty.py.

qq_gaussian(y_true, y_pred, y_std) qq_gaussian(y_true, y_pred, y_std: dict)
normal-prob-plot normal-prob-plot-multiple
error_decay_with_uncert(y_true, y_pred, y_std) error_decay_with_uncert(y_true, y_pred, y_std: dict)
error-decay-with-uncert error-decay-with-uncert-multiple

Cumulative Metrics

See pymatviz/cumulative.py.

cumulative_error(preds, targets) cumulative_residual(preds, targets)
cumulative-error cumulative-residual

Classification

See pymatviz/relevance.py.

roc_curve(targets, proba_pos) precision_recall_curve(targets, proba_pos)
roc-curve precision-recall-curve

Correlation

See pymatviz/correlation.py.

marchenko_pastur(corr_mat, gamma=ncols/nrows) marchenko_pastur(corr_mat_significant_eval, gamma=ncols/nrows)
marchenko-pastur marchenko-pastur-significant-eval

How to cite pymatviz

See citation.cff or cite the Zenodo record using the following BibTeX entry:

@software{riebesell_pymatviz_2022,
  title = {Pymatviz: visualization toolkit for materials informatics},
  author = {Riebesell, Janosh and Goodall, Rhys and Baird, Sterling G.},
  date = {2022-10-01},
  year = {2022},
  doi = {10.5281/zenodo.7486816},
  url = {https://github.com/janosh/pymatviz},
  note = {10.5281/zenodo.7486816 - https://github.com/janosh/pymatviz},
  urldate = {2023-01-01}, % optional, replace with your date of access
  version = {0.8.1}, % replace with the version you use
}

More Repositories

1

awesome-normalizing-flows

Awesome resources on normalizing flows.
Python
1,378
star
2

awesome-sveltekit

Awesome examples of SvelteKit in the wild
Svelte
814
star
3

svelte-multiselect

Keyboard-friendly, accessible and highly customizable multi-select component
TypeScript
240
star
4

tikz

Random collection of standalone TikZ images
TeX
165
star
5

blog

My blog.
Svelte
119
star
6

elementari

Interactive visualizations for materials science: periodic tables, 3d crystal structures, Bohr atoms, nuclei, heatmaps, scatter plots.
TypeScript
102
star
7

svelte-toc

Sticky responsive table of contents component
Svelte
89
star
8

matbench-discovery

An evaluation framework for machine learning models simulating high-throughput materials discovery.
Python
86
star
9

svelte-bricks

Naive Svelte Masonry component without column balancing (ragged columns at the bottom)
Svelte
75
star
10

tensorboard-reducer

Reduce multiple PyTorch TensorBoard runs to new event (or CSV) files.
Python
58
star
11

svelte-algolia

Svelte plugin for keeping Algolia indices in sync with custom data fetching functions.
TypeScript
33
star
12

pdf-compressor

CLI + Python API for batch compressing PDFs
Python
27
star
13

torch-mnf

Multiplicative Normalizing Flows in PyTorch.
Python
19
star
14

svicons

35 SVG Icon Packs as Svelte Components
Svelte
13
star
15

thermo

Data-driven risk-conscious thermoelectric materials discovery
Python
11
star
16

geometric-bayes

Interactive geometric illustration of Bayes theorem
Svelte
11
star
17

ffonons

Phonons from ML force fields
Python
11
star
18

gatsby-source-google-scholar

Gatsby source plugin that pulls metadata for scientific publications from Google Scholar
JavaScript
10
star
19

numeric-simulations

Exercise solutions for Prof. Springel's lecture "Fundamentals of Simulation Methods" (fall 2015, Heidelberg University)
C
7
star
20

dielectrics

Pushing the Pareto front of band gap and permittivity with ML-guided dielectric materials discovery incl. experimental synthesis and characterization.
HTML
6
star
21

tutorific-frontend

React + Redux frontend for 6-day Codeworks solo project 'Tutorific'.
JavaScript
6
star
22

svelte-zoo

Random assortment of docs-related Svelte components
Svelte
3
star
23

ocean-artup

Homepage of the ERC Advanced Grant research project Ocean artUp
Svelte
3
star
24

dark-mode-minimal

SSR compatible, flicker-free dark mode MVP in Gatsby
JavaScript
2
star
25

afara

Homepage of the German student-run non-profit Afara e.V. built Svelte and Contentful.
Svelte
2
star
26

tf-mnf

Multiplicative normalizing flow: variational Bayesian neural networks with increased posterior flexibility thanks to normalizing flows
Python
2
star
27

joggle-atoms-as-data-aug

Experiments with CGCNN + Atom Joggling for data augmentation
Python
1
star
28

macos-setup

Ain't no place like ~. Scripts and config files to setup macOS from scratch.
Shell
1
star