Skip to content

PlateHeatmap

Microplate heatmap supporting 6 to 1536-well formats with multiple color scales.

Demo

Usage

svelte
<script>
  import { PlateHeatmap } from '@molbiohive/hatchlings';
</script>

<PlateHeatmap data={plateData} width={500} height={350} />

Data Type — PlateData

FieldTypeRequiredDescription
formatPlateFormatyes6 | 12 | 24 | 48 | 96 | 384 | 1536
wellsWell[]yesWell data
titlestringnoPlate title

Props

PropTypeDefaultDescription
dataPlateDataPrimary data prop
widthnumber500SVG width
heightnumber350SVG height
colorScalestring'viridis'Color scale
showLabelsbooleantrueShow well labels

Example — Constructing Data

ts
import type { PlateData } from '@molbiohive/hatchlings';

const data: PlateData = {
  format: 96,
  wells: (() => {
    const w = [];
    for (let r = 0; r < 8; r++) {
      for (let c = 0; c < 12; c++) {
        const id = String.fromCharCode(65 + r) + (c + 1);
        // Deterministic values
        const seed = Math.sin((r * 12 + c) * 127.1) * 43758.5453;
        let v = (seed - Math.floor(seed)) * 100;
        let g = 'sample';
        if (c === 0) { v = 95 + (seed - Math.floor(seed)) * 5; g = 'positive'; }
        if (c === 11) { v = (seed - Math.floor(seed)) * 8; g = 'negative'; }
        w.push({ id, value: v, group: g });
      }
    }
    return w;
  })(),
};

This is the data powering the demo above. See docs/data/charts.ts for the full source.