Skip to content

Facet with varying scales? #8

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
mbostock opened this issue Oct 29, 2020 · 7 comments
Open

Facet with varying scales? #8

mbostock opened this issue Oct 29, 2020 · 7 comments
Labels
enhancement New feature or request

Comments

@mbostock
Copy link
Member

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

@mbostock mbostock added the enhancement New feature or request label Nov 3, 2020
@mbostock
Copy link
Member Author

Related #149.

@aaronschiff
Copy link

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.

@Fil
Copy link
Contributor

Fil commented Dec 10, 2022

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

@Fil
Copy link
Contributor

Fil commented Dec 22, 2022

related #501

@Fil
Copy link
Contributor

Fil commented Jul 18, 2023

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

@adityawarmanfw

This comment was marked as off-topic.

@mbostock
Copy link
Member Author

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants