« home

elementari Examples

Materials Project Element Heatmap

Data set  
Log color scale
1 H 82.6k
2 He 8
3 Li 69.3k
4 Be 3.37k
5 B 24.2k
6 C 32.2k
7 N 38.5k
8 O 724k
9 F 65.4k
10 Ne 1
11 Na 20.8k
12 Mg 86.9k
13 Al 26.6k
14 Si 30.8k
15 P 47.9k
16 S 52.5k
17 Cl 26.9k
18 Ar 2
19 K 16.1k
20 Ca 17.1k
21 Sc 4.76k
22 Ti 17.3k
23 V 21.6k
24 Cr 13.9k
25 Mn 34.9k
26 Fe 37.9k
27 Co 29.6k
28 Ni 24.4k
29 Cu 22.2k
30 Zn 13.4k
31 Ga 13k
32 Ge 14.2k
33 As 8.94k
34 Se 24.8k
35 Br 12.2k
36 Kr 26
37 Rb 9.08k
38 Sr 16.1k
39 Y 8.75k
40 Zr 8.17k
41 Nb 10.9k
42 Mo 13.2k
43 Tc 1.12k
44 Ru 5k
45 Rh 6.3k
46 Pd 7.19k
47 Ag 8.22k
48 Cd 6.7k
49 In 8.71k
50 Sn 12.5k
51 Sb 12.1k
52 Te 13.5k
53 I 11.8k
54 Xe 303
55 Cs 7.27k
56 Ba 18.1k
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
72 Hf 4.41k
73 Ta 6.01k
74 W 9.35k
75 Re 3.01k
76 Os 2.19k
77 Ir 4.08k
78 Pt 5.19k
79 Au 5.09k
80 Hg 5.45k
81 Tl 5.53k
82 Pb 6.82k
83 Bi 11.7k
84 Po Polonium
85 At Astatine
86 Rn Radon
87 Fr Francium
88 Ra Radium
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
104 Rf Rutherfordium
105 Db Dubnium
106 Sg Seaborgium
107 Bh Bohrium
108 Hs Hassium
109 Mt Meitnerium
110 Ds Darmstadtium
111 Rg Roentgenium
112 Cn Copernicum
113 Nh Nihonium
114 Fl Flerovium
115 Mc Moscovium
116 Lv Livermorium
117 Ts Tennessine
118 Og Oganesson
57-71 La-Lu Lanthanides
89-103 Ac-Lr Actinides
0 200k 400k 600k 800k
<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 &ensp; <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;" />