Commit 44b4a1d
raster mark (observablehq#1196)
* image data mark
* PreTtiER
* handle invalid data; stride, offset
* handle flipped images
* archive test failure artifacts
* skip image data tests, for now
* PreTtiER
* only ignore generated images in CI
* only ignore large generated images
* fillOpacity
* tweak
* fix formula
* PreTtiER
* volcano
* more idiomatic heatmap
* fill as f(x, y)
* pixel midpoints
* PreTtiER
* not pixelated, again
* PreTtiER
* raster
* pixelRatio
* fix aria-label; comments
* Goldstein–Price
* tentative documentation for Plot.raster
* fix partial coverage of sample fill
* raster fillOpacity
* require x1, y1, x2, y2
* validate width, height
* fix for sparse samples
* better error on missing scales
* document
* floor rounded (or floored?)
* exploration for a "nearest" raster interpolate method
* barycentric interpolation
see https://observablehq.com/@visionscarto/igrf-90
* raster tuple shorthand
* barycentric interpolate and extrapolate
* only maybeTuple if isTuples
* allow marks to apply scales selectively (like we do with projections)
* interpolate on values
* 3 interpolation methods for the nearest neighbor: voronoi renderCell, quadree.find, delaunay.find. This is completely gratuitous since they all run in less than 1ms… It's even hard to know which one is the fastest, because if I loop on 100s of them the browser starts to thrash (allocating so much memory for images it immediately discards, I guess…)
* barycentric walmart
* fold mark.project into mark.scale
* fix barycentric extrapolation
* materialize fewer arrays
* use channel names
* don’t pass {r, g, b, a}
* don’t overload x & y channels
* fix inverted x or y; simplify example
* simpler
* fix grid orientation
* only stroke if opaque
* optional x1, y1, x2, y2
* shorten
* fix order
* const
* rasterize
* The performance measurements I had done were just rubbish (I forgot to await on the promises!).
Measuring the three methods on the ca55 dataset I see this order: voronoi cellRender (180ms), delaunay find (220ms), quadtree (500ms).
* rasterize
* tolerance for points that are on a triangle's edge
* use a symbol for values that need extrapolation, simplify and fix a few issues, use a mixing function for categorical interpolation
* rasterize with walk on spheres
* document rasterize
* pixelSize
* default to full frame
* remove ignored options
* reformat options
* fix the ca55 tests (the coordinates represent a planar projection)
* caveat about webkit/safari
* remove console.log
* more built-in rasterizers
* fix walk-on-spheres implementation; remove blur
* port fixes to wos
* adaptive extrapolation
* fillOpacity fixes
* renames walk-on-spheres to random-walk; documents the rasterize option
rationale for the renaming: "random-walk" is more commonly known, and expresses well enough what's happening. Walk on spheres converges much faster than a basic random walk would, and makes it feasible, but it is a question of implementation.
* a constant fillOpacity informs the opacity property on the g element, not the opacity of each pixel
* fix bug with projection clip in indirectStyles
* performance optimizations for randow-walk:
1. use rasterizeNull to boot; if we have more samples (and a costlier delaunay), at least we have less pixels to impute.
2. cache more aggressively the result of delaunay.find: at the beginning of each line, for each pixel, and for each step of the walk
On actual tests it can be up to 2x faster.
* sample pixel centroids
* fix handling of undefined values
* use transform for equirectangular coordinates
* don’t delete
* stroke if constant fillOpacity
* fix test snapshots
* fix typo in test name
* note potential bias caused by stroke
* rename tests
* don’t bootstrap random-walk with none
* terminate walk when minimum distance is reached
* comment re. opacity
* comment re. none order bias
* contour mark
* dense grid contours
* consolidate code
* more code consolidation
* cleaner
* cleaner deferred channels
* interpolate, not rasterize
* blur
* cleaner
* use typed array when possible
* optimize barycentric interpolation
* nicer contours for ca55 with barycentric+blur 3; support raster blur
Contour blurring is unchanged, and blurs the abstract data (with a linear interpolation).
Raster blurring is made with d3.blurImage. Two consequences:
* we can now blur “categorical” colors, if we want to smooth out the image and give it a polished look in the higher variance regions. (This works very well when we have two colors, but with more categories there is a risk of hiding the components of a color, making the image more difficult to understand. Anyway, it’s available as an option to play with.)
* for quantitative data, and with a color scale with continuous scheme and linear transform, this is very close to linear interpolation; but if the underlying data is better rendered with a log color scale, the color interpolation takes this into account (which IMO is better).
* ignore negative blur
* cleaner tests
* for contours, filter points with missing X and Y before calling the interpolate function, and ignore x and y filters on geometries
* fix barycentric interpolate for filtered points
note: the penguins dataset is full of surprises since some points are occluded by others of a different species…
* contour shorthands
* fix contour filtering
* filter value, too
* materialize x and y when needed
* default to nearest
* comment
* remove obsolete opacity trick
* better contour thresholds; fix test
* nullish instead of undefined
* renderBounds
* fix circular import
* a hand-written Peters projection seemed more fun than the sqrt scale; tests the same thing
* update raster documentation with interpolate; document contour
* document Plot.identity
* peters axes
* symmetric Peters
* style tweak
* NaN instead of null
* avoid error when empty quantile domain
* faceted sampler raster
* fix test snapshot
* faceted contour; fix dense faceted raster
… and fix default contour thresholds
* expose spatial interpolators
* pass x, y, step
* error when data undefined, but not null
* d3 7.8.1
Co-authored-by: Philippe Rivière <[email protected]>1 parent e44f007 commit 44b4a1d
57 files changed
Lines changed: 9124 additions & 560 deletions
File tree
- .github/workflows
- src
- marks
- scales
- transforms
- test
- data
- output
- plots
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1112 | 1112 | | |
1113 | 1113 | | |
1114 | 1114 | | |
| 1115 | + | |
| 1116 | + | |
| 1117 | + | |
| 1118 | + | |
| 1119 | + | |
| 1120 | + | |
| 1121 | + | |
| 1122 | + | |
| 1123 | + | |
| 1124 | + | |
| 1125 | + | |
| 1126 | + | |
| 1127 | + | |
| 1128 | + | |
| 1129 | + | |
| 1130 | + | |
| 1131 | + | |
| 1132 | + | |
| 1133 | + | |
| 1134 | + | |
| 1135 | + | |
| 1136 | + | |
| 1137 | + | |
| 1138 | + | |
| 1139 | + | |
| 1140 | + | |
| 1141 | + | |
| 1142 | + | |
| 1143 | + | |
| 1144 | + | |
| 1145 | + | |
| 1146 | + | |
| 1147 | + | |
| 1148 | + | |
| 1149 | + | |
| 1150 | + | |
| 1151 | + | |
| 1152 | + | |
| 1153 | + | |
| 1154 | + | |
| 1155 | + | |
| 1156 | + | |
| 1157 | + | |
| 1158 | + | |
| 1159 | + | |
| 1160 | + | |
| 1161 | + | |
| 1162 | + | |
| 1163 | + | |
| 1164 | + | |
| 1165 | + | |
| 1166 | + | |
| 1167 | + | |
| 1168 | + | |
| 1169 | + | |
| 1170 | + | |
| 1171 | + | |
| 1172 | + | |
| 1173 | + | |
| 1174 | + | |
1115 | 1175 | | |
1116 | 1176 | | |
1117 | 1177 | | |
| |||
1504 | 1564 | | |
1505 | 1565 | | |
1506 | 1566 | | |
| 1567 | + | |
| 1568 | + | |
| 1569 | + | |
| 1570 | + | |
| 1571 | + | |
| 1572 | + | |
| 1573 | + | |
| 1574 | + | |
| 1575 | + | |
| 1576 | + | |
| 1577 | + | |
| 1578 | + | |
| 1579 | + | |
| 1580 | + | |
| 1581 | + | |
| 1582 | + | |
| 1583 | + | |
| 1584 | + | |
| 1585 | + | |
| 1586 | + | |
| 1587 | + | |
| 1588 | + | |
| 1589 | + | |
| 1590 | + | |
| 1591 | + | |
| 1592 | + | |
| 1593 | + | |
| 1594 | + | |
| 1595 | + | |
| 1596 | + | |
| 1597 | + | |
| 1598 | + | |
| 1599 | + | |
| 1600 | + | |
| 1601 | + | |
| 1602 | + | |
| 1603 | + | |
| 1604 | + | |
| 1605 | + | |
| 1606 | + | |
| 1607 | + | |
| 1608 | + | |
| 1609 | + | |
| 1610 | + | |
| 1611 | + | |
| 1612 | + | |
| 1613 | + | |
| 1614 | + | |
| 1615 | + | |
| 1616 | + | |
| 1617 | + | |
| 1618 | + | |
| 1619 | + | |
| 1620 | + | |
| 1621 | + | |
| 1622 | + | |
| 1623 | + | |
1507 | 1624 | | |
1508 | 1625 | | |
1509 | 1626 | | |
| |||
2771 | 2888 | | |
2772 | 2889 | | |
2773 | 2890 | | |
| 2891 | + | |
| 2892 | + | |
| 2893 | + | |
| 2894 | + | |
| 2895 | + | |
| 2896 | + | |
| 2897 | + | |
| 2898 | + | |
| 2899 | + | |
| 2900 | + | |
| 2901 | + | |
| 2902 | + | |
2774 | 2903 | | |
2775 | 2904 | | |
2776 | 2905 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| 7 | + | |
7 | 8 | | |
8 | 9 | | |
9 | 10 | | |
| |||
14 | 15 | | |
15 | 16 | | |
16 | 17 | | |
| 18 | + | |
| 19 | + | |
17 | 20 | | |
18 | 21 | | |
19 | 22 | | |
20 | 23 | | |
21 | 24 | | |
22 | 25 | | |
23 | | - | |
| 26 | + | |
24 | 27 | | |
25 | 28 | | |
26 | 29 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
0 commit comments