Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add new plotly function sankey_from_2_df_cols() #37

Merged
merged 5 commits into from
May 21, 2022
Merged

Conversation

janosh
Copy link
Owner

@janosh janosh commented May 21, 2022

Closes #26.

Examples

Random integers

import numpy as np
import pandas as pd

from pymatviz import sankey_from_2_df_cols

col_names = "col_a col_b".split()

df = pd.DataFrame(np.random.randint(1, 6, size=(100, 2)), columns=col_names)

fig = sankey_from_2_df_cols(df, col_names, labels_with_counts="percent")

sankey_from_2_df_cols_randints]

from matminer.datasets import load_dataset

df_perov = load_dataset("matbench_perovskites")

# omitted lengthy code to calculate aflow and spglib spacegroups
# see examples/matbench_perovskites.ipynb
# ...

fig = sankey_from_2_df_cols(df_perov, ["spglib_spg_num", "aflow_spg_num"])

fig.update_layout(title="Matbench Perovskites Spglib vs Aflow Spacegroups")

sankey_spglib_vs_aflow

@janosh janosh merged commit b73dbfa into main May 21, 2022
@janosh janosh deleted the sankey-from-2-df-cols branch May 21, 2022 17:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

New plot type: Sankey diagram
1 participant