Skip to content

z bin - #196

Merged
mbostock merged 12 commits into
mbostock/compose-transformfrom
mbostock/bin-z
Mar 8, 2021
Merged

z bin#196
mbostock merged 12 commits into
mbostock/compose-transformfrom
mbostock/bin-z

Conversation

@mbostock

@mbostock mbostock commented Mar 7, 2021

Copy link
Copy Markdown
Member

Ref. #195 (comment)

A little cumbersome to implement, but it seems to work, and I think I can clean it up. Still need to implement z inheriting from fill or stroke as needed.

@mbostock
mbostock requested a review from Fil March 7, 2021 19:11
@mbostock

mbostock commented Mar 7, 2021

Copy link
Copy Markdown
Member Author

It works! 👏

Screen Shot 2021-03-07 at 11 23 06 AM

Plot.plot({
  x: {
    round: true,
    label: "Body mass (g) →"
  },
  y: {
    grid: true
  },
  marks: [
    Plot.rect(data, Plot.stackY(Plot.binX({x: "body_mass_g", fill: "species"}))),
    Plot.ruleY([0])
  ]
})

@Fil

Fil commented Mar 8, 2021

Copy link
Copy Markdown
Contributor

I've generalized this to 2d bins in #198, and allowed to specify thresholds_x and thresholds_y separately.

I think a later step would be to allow mixing x binning with y grouping (and vice-versa). I'm strongly biased towards unifying grouping and various systems of binning (uniform, jenks…) into a unique operator.

* generealize z-bin1 to z-bin2
example http://localhost:8008/?test=penguinSexMassCulmenSpecies

remove unused functions

* allow separate thresholds_x and thresholds_y
(most useful when we want to specify them as arrays of values)

* a grid to match the binning

* tweaks

Co-authored-by: Mike Bostock <mbostock@gmail.com>
@mbostock
mbostock merged commit 44be781 into mbostock/compose-transform Mar 8, 2021
@mbostock
mbostock deleted the mbostock/bin-z branch March 8, 2021 19:14
mbostock added a commit that referenced this pull request Mar 8, 2021
* composable transform

* fix crash on const z

* remove basic transform support

* normalize transform

* remove unused import

* movingAverage transform

* propagate computed channels

* stack transform

* preserve data during select

* fix select

* simpler composite transform

* fix select, normalize

* restore stack transform

* restore movingAverage transform

* minimize diff

* revert tests

* restore group transform

* fix tests

* restore bin transform

* fix label

* shorter

* cleaner

* cleaner bin

* more flexible rect[XY]

* z bin (#196)

* z bin

* z, x1 inheritance

* stacked bin test

* use rectY

* more TODO

* x1, y1 inheritance

* bins as grouped data

* fix x inheritance

* bin1 normalize

* simplify

* reorder

* bin-z for 2D bins (#198)

* generealize z-bin1 to z-bin2
example http://localhost:8008/?test=penguinSexMassCulmenSpecies

remove unused functions

* allow separate thresholds_x and thresholds_y
(most useful when we want to specify them as arrays of values)

* a grid to match the binning

* tweaks

Co-authored-by: Mike Bostock <mbostock@gmail.com>

Co-authored-by: Philippe Rivière <fil@rezo.net>

* format

* group1 sort by x

* group2

* rename

* consolidate

* fix #201; group domain option

Co-authored-by: Philippe Rivière <fil@rezo.net>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants