You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* density contours as an initializer: first pass
* density by z, carrying styles and channels (no reducer, only "first")
* fill: "density"
* density weight
* consistent thresholds across facets and series
note: we have to go around this bug in d3-contour: d3/d3-contour#57
* allow initializer composition; move initializer to the class; clean up
* density weight example
* error if x or y is undefined
(in the future we might route those to 1-dimensional transforms—KDE)
* document
* reduce img
* * don't apply the scales if we are already in pixel space (e.g. when composing with the hexbin transform)
* avoids a crash when there is no contour
* 1d density contours with frameAnchor
* adopt d3@7.4.5 for https://github.com/d3/d3-contour/releases/tag/v3.0.2
(not entirely sure if it's good practice to have all the yarn.lock changes in the PR, beyond those that are relevant)
* replace example image
* mike’s edits
* fix image dimensions
* isDensity
* distinct
* tweak tests
Co-authored-by: Mike Bostock <mbostock@gmail.com>
Copy file name to clipboardExpand all lines: README.md
+17-1Lines changed: 17 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1022,6 +1022,22 @@ Draws a mesh for the cell boundaries of the Voronoi tesselation of the points gi
1022
1022
1023
1023
If a **z** channel is specified, the input points are grouped by *z*, and separate Voronoi tesselations are constructed for each group.
1024
1024
1025
+
### Density
1026
+
1027
+
[<img src="./img/density-contours.png" width="320" height="200" alt="A scatterplot showing the relationship between the idle duration and eruption duration for Old Faithful">](https://observablehq.com/@observablehq/plot-density)
1028
+
1029
+
[Source](./src/marks/density.js) · [Examples](https://observablehq.com/@observablehq/plot-density) · Draws regions of a two-dimensional point distribution in which the number of points per unit of screen space exceeds a certain density.
1030
+
1031
+
#### Plot.density(*data*, *options*)
1032
+
1033
+
Draws a region for each density level where the number of points given by the **x** and **y** channels, and possibly weighted by the **weight** channel, exceeds the given level. The **thresholds** option, which defaults to 20, indicates the approximate number of levels that will be computed at even intervals between 0 and the maximum density.
1034
+
1035
+
If a **z**, **stroke** or **fill** channel is specified, the input points are grouped by series, and separate sets of contours are generated for each series.
1036
+
1037
+
If stroke or fill is specified as *density*, a color channel is returned with values representing the density normalized between 0 and 1.
1038
+
1039
+
If either of the **x** or **y** channels are not specified, the corresponding position is controlled by the **frameAnchor** option.
@@ -1135,7 +1151,7 @@ Returns a new image with the given *data* and *options*. If neither the **x** no
1135
1151
1136
1152
### Linear regression
1137
1153
1138
-
[<img src="./img/linear-regression.png" width="600" alt="a scatterplot of penguin culmens, showing the length and depth of several species, with linear regression models by species and for the whole population, illustrating Simpson’s paradox">](https://observablehq.com/@observablehq/plot-linear-regression)
1154
+
[<img src="./img/linear-regression.png" width="320" height="200" alt="a scatterplot of penguin culmens, showing the length and depth of several species, with linear regression models by species and for the whole population, illustrating Simpson’s paradox">](https://observablehq.com/@observablehq/plot-linear-regression)
1139
1155
1140
1156
[Source](./src/marks/linearRegression.js) · [Examples](https://observablehq.com/@observablehq/plot-linear-regression) · Draws [linear regression](https://en.wikipedia.org/wiki/Linear_regression) lines with confidence bands, representing the estimated relation of a dependent variable (typically *y*) on an independent variable (typically *x*). The linear regression line is fit using the [least squares](https://en.wikipedia.org/wiki/Least_squares) approach. See Torben Jansen’s [“Linear regression with confidence bands”](https://observablehq.com/@toja/linear-regression-with-confidence-bands) and [this StatExchange question](https://stats.stackexchange.com/questions/101318/understanding-shape-and-calculation-of-confidence-bands-in-linear-regression) for details on the confidence interval calculation.
0 commit comments