Skip to content

Commit

Permalink
use fill_value = 0
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielYang59 committed Oct 8, 2024
1 parent 7ea2690 commit 5f301be
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion pymatviz/histogram.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def elements_hist(
Args:
formulas (list[str]): compositional strings, e.g. ["Fe2O3", "Bi2Te3"].
count_mode ("composition" | "fractional_composition" | "reduced_composition"):
Reduce or normalize compositions before counting. See count_elements() for
Reduce or normalize compositions before counting. See `count_elements` for
details. Only used when formulas is list of composition strings/objects.
log (bool, optional): Whether y-axis is log or linear. Defaults to False.
keep_top (int | None): Display only the top n elements by prevalence.
Expand Down
6 changes: 3 additions & 3 deletions pymatviz/ptable/ptable_matplotlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,7 @@ def ptable_heatmap_ratio(
--- Data preprocessing ---
count_mode ("composition" | "fractional_composition" | "reduced_composition"):
Reduce or normalize compositions before counting. See count_elements() for
Reduce or normalize compositions before counting. See `count_elements` for
details. Only used when values is list of composition strings/objects.
normalize (bool): Whether to normalize heatmap values so they sum to 1. Makes
different ptable_heatmap_ratio plots comparable. Defaults to False.
Expand Down Expand Up @@ -418,8 +418,8 @@ def ptable_heatmap_ratio(
plt.Figure: matplotlib Figure object.
"""
# Generate ratio data
values_num = count_elements(values_num, count_mode)
values_denom = count_elements(values_denom, count_mode)
values_num = count_elements(values_num, count_mode, fill_value=0)
values_denom = count_elements(values_denom, count_mode, fill_value=0)

values = values_num / values_denom

Expand Down

0 comments on commit 5f301be

Please sign in to comment.