Materials Project Element Heatmap
2 He 8
10 Ne 1
18 Ar 2
36 Kr 26
54 Xe 303
57 La 12.6k
58 Ce 5.93k
59 Pr 6.12k
60 Nd 6.9k
61 Pm 822
62 Sm 5.89k
63 Eu 3.69k
64 Gd 2.76k
65 Tb 4.54k
66 Dy 4.59k
67 Ho 4.49k
68 Er 4.71k
69 Tm 3.37k
70 Yb 4.39k
71 Lu 3.06k
86 Rn Radon
89 Ac 496
90 Th 1.94k
91 Pa 374
92 U 4.54k
93 Np 577
94 Pu 740
95 Am Americium
96 Cm Curium
97 Bk Berkelium
98 Cf Californium
99 Es Einsteinium
100 Fm Fermium
101 Md Mendelevium
102 No Nobelium
103 Lr Lawrencium
118 Og Oganesson
57-71 La-Lu Lanthanides
89-103 Ac-Lr Actinides
<script>
import { PeriodicTable, TableInset, ColorBar, ColorScaleSelect } from '$lib'
import { pretty_num } from '$lib/labels'
import Multiselect from 'svelte-multiselect'
import { RadioButtons, Toggle } from 'svelte-zoo'
import mp_elem_counts from './mp-element-counts.json'
import wbm_elem_counts from './wbm-element-counts.json'
import { extent } from 'd3-array'
let log = true // log color scale
let data = `MP`
let color_scale = 'Viridis'
$: heatmap_values = Object.values(data == `WBM` ? wbm_elem_counts : mp_elem_counts)
$: total = heatmap_values.reduce((a, b) => a + b, 0)
</script>
<h2>{data == 'MP' ? 'Materials Project' : 'WBM'} Element Heatmap</h2>
<section>
<span>Data set   <RadioButtons options={[`MP`, `WBM`]} bind:selected={data} /></span>
<span>Log color scale <Toggle bind:checked={log} /></span>
<ColorScaleSelect bind:value={color_scale} selected={[color_scale]} />
</section>
<PeriodicTable {heatmap_values} {log} {color_scale}>
<TableInset slot="inset" style="grid-row: 3;" let:active_element>
{#if active_element?.name}
<strong>
{active_element?.name}: {pretty_num(mp_elem_counts[active_element?.symbol])}
<!-- compute percent of total -->
{#if mp_elem_counts[active_element?.symbol] > 0}
({pretty_num((mp_elem_counts[active_element?.symbol] / total) * 100)}%)
{/if}
</strong>
{/if}
</TableInset>
</PeriodicTable>
<ColorBar range={extent(heatmap_values)} {color_scale} tick_labels={5} style="width: 100%; margin: 2em 1em;" />