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

Can not overlap barY and barY. #2016

Closed mekterovic closed 5 months ago

mekterovic commented 6 months ago

Can not overlap (faceted) barY and barY (but can dot and barY).

Working demo is here: https://talk.observablehq.com/t/can-not-overlap-bary-and-bary-but-can-dot-and-bary/8903

If I change the line: Plot.dot(data2, { to: Plot.barY(data2, { it fails with: TypeError: Cannot read properties of undefined (reading 'constructor')

So, dot+dot, and dot+barY works, but barY+barY does not.

mbostock advised to file as a bug with the following comment:

"This might be a bug in Plot when the two bar marks have different faceting. One has fx and fy; the other only fx. So, the one with only fx needs to be repeated across the fy facets. Can you file a bug on the Plot repo?"

mbostock commented 5 months ago

This is a bug with the stack transform during faceting (which is used implicitly by the bar mark, but not the dot mark).