observablehq / plot

A concise API for exploratory data visualization implementing a layered grammar of graphics
https://observablehq.com/plot/
ISC License
4.25k stars 173 forks source link

Chart with facets: ticks overflow #2025

Closed Jerboas86 closed 5 months ago

Jerboas86 commented 5 months ago

In charts with facets: If ticks property is defined without domain property, the axis will overflow.

Bug reproduction

(see observablehq)

Expected behavior

Fil commented 5 months ago

can you share the notebook? 🙏

Jerboas86 commented 5 months ago

can you share the notebook? 🙏

Sorry for that, it should be public now

Fil commented 5 months ago

That's the expected behavior. If you want to derive the domain from the ticks, you can add a mark that will inject the ticks into the channels considered to build the domain. Or better yet, use the axisX mark with explicit ticks:

  Plot.axisX([125, 250, 500, 1000, 2000, 4000, 8000]),

and then you don't need to specify them again in the specification for the x scale.

Jerboas86 commented 5 months ago

the axis of Facet A goes over axis of facet B, how that can be the expected behavior ?

Fil commented 5 months ago

"Expected behavior" does not mean that it results in a great chart, only that it's what the code is expected to do.