plot icon indicating copy to clipboard operation
plot copied to clipboard

Facet with varying scales?

Open mbostock opened this issue 5 years ago • 7 comments

Currently faceting repeats scales. What if you want a scale that varies by facet, as in a SPLOM?

mbostock avatar Oct 29 '20 22:10 mbostock

Related #149.

mbostock avatar Feb 24 '21 22:02 mbostock

It would be great if this could be implemented. It's common to have a categorical scale where not all categories appear in all facets, so you want to hide the unused categories in some facets to save space.

aaronschiff avatar Aug 19 '22 02:08 aaronschiff

Similarly would be nice to allow a projection to have a different domain for each facet.

Fil avatar Dec 10 '22 09:12 Fil

related #501

Fil avatar Dec 22 '22 10:12 Fil

Here's an initializer that rescales y on every facet. It doesn't really have access to the scale’s type yet, but it's a great use case to have the scale’s definition passed in properly here too (in #1263).

scalefreeY = (options) =>
  Plot.initializer(options, (data, facets, channels, scales, dimensions) => {
    const {y: { value: Y, scale }} = channels;
    for (const index of facets) {
      const y = d3.scalePoint(d3.sort(Array.from(index, (i) => Y[i])), [
          dimensions.marginTop,
          dimensions.height - dimensions.marginBottom
        ])
        .padding(0.5);
      for (const i of index) Y[i] = y(Y[i]);
    }
    return { data, facets, channels: { y: { value: Y } } };
  })

suggested by @mayagans

Fil avatar Jul 18 '23 06:07 Fil

This feature would be very helpful!

adityawarmanfw avatar Mar 15 '24 08:03 adityawarmanfw

Please click the 👍 on the top post if you’re interested in this feature. +1 replies are not (explicitly) counted and generate noise for people who are subscribed to this issue. Thank you!

mbostock avatar Mar 15 '24 15:03 mbostock