Status Quo
Currently the spacing between facets needs to be set via the implied band scale’s padding option. [1] However, that option only allows adjusting the spacing relative to the band width (or height). [2]
Motivation
For my use case, I’d like to reserve some space between the facets to repeat the x axis between them. Since I know the amount of space the tick labels will need, I’d like to instruct Plot to leave a gap of a certain fixed size.
Problem
With the current API I need to guess the amount of space Plot will use for a single facet and find a fraction that will leave an appropriate amount of space. If Plot decides that a facet should be larger (in the examples below I forced bigger facets), then my space is at risk of being too small or too large.
Examples
The examples are based on [3].
Appropriate spacing
Plot.plot({
fy: {
padding: .15
},
marks: [
Plot.barY(brands, {
x: "name",
y: "value",
fy: (d, i) => i % 3,
}),
Plot.axisX({
facetAnchor: null,
})
],
})
Excessive spacing
Plot.plot({
fy: {
padding: .15
},
marks: [
Plot.barY(brands, {
x: "name",
y: "value",
fy: (d, i) => i % 3,
}),
Plot.axisX({
facetAnchor: null,
})
],
height: 1000,
})
[1] https://observablehq.com/plot/features/facets#facet-scales
[2] https://observablehq.com/plot/features/scales#discrete-scales
[3] https://observablehq.com/@observablehq/plot-vertical-bars-rotated-labels
Status Quo
Currently the spacing between facets needs to be set via the implied band scale’s padding option. [1] However, that option only allows adjusting the spacing relative to the band width (or height). [2]
Motivation
For my use case, I’d like to reserve some space between the facets to repeat the x axis between them. Since I know the amount of space the tick labels will need, I’d like to instruct Plot to leave a gap of a certain fixed size.
Problem
With the current API I need to guess the amount of space Plot will use for a single facet and find a fraction that will leave an appropriate amount of space. If Plot decides that a facet should be larger (in the examples below I forced bigger facets), then my space is at risk of being too small or too large.
Examples
The examples are based on [3].
Appropriate spacing
Excessive spacing
[1] https://observablehq.com/plot/features/facets#facet-scales
[2] https://observablehq.com/plot/features/scales#discrete-scales
[3] https://observablehq.com/@observablehq/plot-vertical-bars-rotated-labels