diff --git a/README.md b/README.md index fa161d1b4c..073043c083 100644 --- a/README.md +++ b/README.md @@ -2250,8 +2250,6 @@ The following aggregation methods are supported: * a function to be passed the array of values for each bin and the extent of the bin * an object with a *reduce* method -When the hexbin transform has an *r* output channel, bins are returned in order of descending radius. - See also the [hexgrid](#hexgrid) mark. ### Custom initializers diff --git a/src/transforms/hexbin.js b/src/transforms/hexbin.js index 0550044aaf..b958947837 100644 --- a/src/transforms/hexbin.js +++ b/src/transforms/hexbin.js @@ -27,7 +27,8 @@ export function hexbin(outputs = {fill: "count"}, inputs = {}) { // Populate default values for the r and symbol options, as appropriate. if (options.symbol === undefined) options.symbol = "hexagon"; - if (options.r === undefined && !hasOutput(outputs, "r")) options.r = binWidth / 2; + if (hasOutput(outputs, "r")) options.r = []; // hint that r channel will exist (e.g., for dot to sort) + else if (options.r === undefined) options.r = binWidth / 2; return initializer(options, (data, facets, {x: X, y: Y, z: Z, fill: F, stroke: S, symbol: Q}, scales) => { if (X === undefined) throw new Error("missing channel: x"); diff --git a/test/output/hexbin.svg b/test/output/hexbin.svg index 7072850287..ca403822cc 100644 --- a/test/output/hexbin.svg +++ b/test/output/hexbin.svg @@ -88,191 +88,191 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/test/output/hexbinR.html b/test/output/hexbinR.html index be583f3ae8..6d10c759ea 100644 --- a/test/output/hexbinR.html +++ b/test/output/hexbinR.html @@ -116,71 +116,128 @@ + + 8 + + + 8 + 7 - - 1 + + 7 - - 2 + + 7 + + + 6 + + + 6 + + + 6 5 - - 2 + + 5 + + + 5 + + + 5 + + + 5 + + + 4 + + + 4 3 - - 1 + + 3 - - 1 + + 3 - - 5 + + 3 - - 1 + + 3 - + + 3 + + 2 - - 4 + + 2 + + + 2 2 - - 6 + + 2 - - 1 + + 2 - - 6 + + 2 - + 2 - + 2 - - 3 + + 2 - + + 2 + + + 2 + + + 2 + + + 2 + + 1 - - 7 + + 1 - - 3 + + 1 + + + 1 + + + 1 + + + 1 1 @@ -200,30 +257,12 @@ 1 - - 5 - - - 3 - 1 - - 5 - 1 - - 2 - - - 2 - - - 2 - 1 @@ -233,15 +272,9 @@ 1 - - 2 - 1 - - 2 - 1 @@ -257,51 +290,18 @@ 1 - - 2 - - - 6 - - - 8 - - - 4 - 1 - - 8 - - - 5 - 1 - - 3 - 1 - - 7 - 1 - - 2 - - - 3 - - - 2 - 1 @@ -319,57 +319,138 @@ + + 11 + + + 10 + + + 9 + + + 8 + + + 6 + + + 6 + 5 - - 1 + + 5 + + + 4 + + + 4 3 - - 2 + + 3 - - 1 + + 3 - - 1 + + 3 - - 1 + + 3 - - 2 + + 3 - + 3 - - 1 + + 3 - - 10 + + 3 - - 9 + + 3 - + + 3 + + 3 + + 3 + + + 2 + + + 2 + 2 + + 2 + + + 2 + + + 2 + + + 2 + + + 2 + + + 2 + + + 2 + + + 2 + + + 2 + + + 2 + + + 2 + + + 1 + + + 1 + + + 1 + + + 1 + + + 1 + 1 1 - - 6 - 1 @@ -379,24 +460,12 @@ 1 - - 3 - - - 3 - 1 1 - - 3 - - - 2 - 1 @@ -406,90 +475,30 @@ 1 - - 2 - - - 3 - - - 8 - - - 3 - - - 2 - - - 2 - 1 - - 4 - - - 2 - 1 1 - - 3 - 1 - - 2 - 1 - - 11 - - - 6 - - - 3 - - - 5 - - - 4 - 1 - - 2 - 1 - - 2 - 1 - - 3 - - - 3 - - - 2 - 1 @@ -502,24 +511,15 @@ 1 - - 3 - 1 - - 2 - 1 1 - - 2 - 1 @@ -534,15 +534,15 @@ + + 2 + 1 1 - - 2 - 1 diff --git a/test/output/hexbinSymbol.html b/test/output/hexbinSymbol.html index 4badaf42c4..82439318dd 100644 --- a/test/output/hexbinSymbol.html +++ b/test/output/hexbinSymbol.html @@ -146,60 +146,113 @@ culmen_depth_mm → + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - @@ -219,30 +272,16 @@ - - - - - - - - - - - - - - @@ -251,46 +290,31 @@ - - - - - - - - - - - - - - - @@ -298,62 +322,38 @@ - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/test/output/hexbinZ.html b/test/output/hexbinZ.html index 2ed1230a13..588aba446e 100644 --- a/test/output/hexbinZ.html +++ b/test/output/hexbinZ.html @@ -95,60 +95,106 @@ - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - @@ -156,12 +202,10 @@ - - @@ -169,40 +213,26 @@ - - - - - - - - - - - - - - @@ -213,59 +243,29 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/test/output/hexbinZNull.svg b/test/output/hexbinZNull.svg index 0b15f2e56f..90a829fc41 100644 --- a/test/output/hexbinZNull.svg +++ b/test/output/hexbinZNull.svg @@ -88,59 +88,114 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -152,18 +207,12 @@ - - - - - - @@ -171,30 +220,17 @@ - - - - - - - - - - - - - @@ -202,12 +238,8 @@ - - - - @@ -216,58 +248,26 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -