vega-lite icon indicating copy to clipboard operation
vega-lite copied to clipboard

Add 'row' and 'column' as resolve options for faceted charts

Open joelostblom opened this issue 2 years ago • 4 comments

If a chart is faceted into columns and rows by two different variables, it is useful to have the scales be the same for each row or column. Currently it is only possible to select that all charts share the same scales or that they are all independent:

Shared

image Open the Chart in the Vega Editor

Independent

image Open the Chart in the Vega Editor

Desired

This is what resolve_scale(y='row') would look like: image

joelostblom avatar Mar 24 '22 07:03 joelostblom

Interesting idea. I wonder whether it's easier to instead require people to write a facet of facet where the inner one has the resolve.

domoritz avatar Mar 24 '22 13:03 domoritz

Thanks, that sounds like a useful workaround. I tried for a bit right now, but can't quite figure out where to place the resolve and from the last two comments in https://github.com/vega/vega-lite/issues/5960#issuecomment-590035177, it seems like nested facets have limited support (although that was two years ago). Do you have an idea of how to implement the workaround with my example above?

joelostblom avatar Mar 24 '22 15:03 joelostblom

Unfortunately I have limited cycles right now and won't be able to check.

My idea right now is that we should make facet of facet work and implement your proposal as a macro.

domoritz avatar Mar 24 '22 15:03 domoritz

I think we should work on making facet of facet work reliably first. Here is what I think your example would look like: Open the Chart in the Vega Editor. I'd have to dig into the Vega to see why the y-scales are not independent.

domoritz avatar Mar 26 '22 16:03 domoritz

+1 for this, would like to use for matrix charts like https://vega.github.io/editor/#/gist/88d3491603f2568da0e93ead880e30dd/spec.json

Shared y scale across each row (but not column) would make it easier to scan across.

declann avatar Sep 09 '23 14:09 declann