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

Better missing value handling strategy for ptable heatmap #230

Open
DanielYang59 opened this issue Oct 10, 2024 · 0 comments
Open

Better missing value handling strategy for ptable heatmap #230

DanielYang59 opened this issue Oct 10, 2024 · 0 comments
Assignees
Labels
matplotlib Concerning matplotlib-powered functions ptable Periodic table

Comments

@DanielYang59
Copy link
Collaborator

DanielYang59 commented Oct 10, 2024

  • Currently missing value would either be replaced by zero or mean, perhaps it's better to add an option to keep missing value as is (shown as -).
  • User cannot control the missing value strategy from ptable_heatmap, which default to mean, leading to erroneous values and statistics.
    missing_strategy: Literal["zero", "mean"] = "mean",
from matminer.datasets import load_dataset

import pymatviz as pmv
from pymatviz.enums import Key


df_expt_gap = load_dataset("matbench_expt_gap")
counted_data = pmv.count_elements(df_expt_gap[Key.composition], fill_value=None)

ax = pmv.ptable_heatmap(
    counted_data,
    value_show_mode="percent",
)
pmv.io.save_and_compress_svg(ax, "./ptable-heatmap.svg")

ptable-heatmap

Should be:
ptable-heatmap

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
matplotlib Concerning matplotlib-powered functions ptable Periodic table
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant