Skip to content

in area and line marks, reduce grouped styles and titles#508

Closed
Fil wants to merge 1 commit into
mainfrom
fil/reduce-grouped-styles
Closed

in area and line marks, reduce grouped styles and titles#508
Fil wants to merge 1 commit into
mainfrom
fil/reduce-grouped-styles

Conversation

@Fil
Copy link
Copy Markdown
Contributor

@Fil Fil commented Aug 18, 2021

closes #503

a typical example would be:

Plot.line(data, {stroke: {value: "value", reduce: "median"}, title: {value: "value", reduce: "mode"}, x: …})

Note: a solution to #503 with the current Plot is:

Plot.line(data, Plot.map({stroke: d => {
  const r = d3.median(d);
  return Array.from(d, () => r);
}}, {stroke: "value", x: })

shorter version (changing only the first element of the channel, since we know that's what's used later):

Plot.line(data, Plot.map({stroke: d => (d[0] = d3.median(d), d) }, {stroke: "value", x: })

This PR introduces a slightly simpler method to call Plot.map. It may not be worth the extra code, documentation, and might be replaced by a link to a good notebook demonstrating Plot.map for this use case!

@Fil Fil requested review from mbostock and zanarmstrong August 18, 2021 08:43
closes #503

a typical example would be:

> Plot.line(data, {stroke: {value: "value", reduce: "median"}, title: {value: "value", reduce: "mode"}, x: …})
@Fil
Copy link
Copy Markdown
Contributor Author

Fil commented Jan 29, 2022

See #724.

@Fil Fil closed this Jan 29, 2022
@Fil Fil deleted the fil/reduce-grouped-styles branch January 29, 2022 16:18
@Fil Fil mentioned this pull request Feb 1, 2022
2 tasks
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.

stroke reduce for lines

1 participant