I created a plot looking like a demography chart and set nice: true for the X axis. This only appears to affect one end of the axis (the left one in my case). That seems like a bug to me.
Here is the example code (without data):
Plot.plot({
x: {
grid: true,
label: "← Unbezahlt · Bezahlt →",
labelAnchor: "center",
tickFormat: Math.abs,
nice: true
},
marks: [
Plot.barX(source, Plot.stackX2({
x: d => d.bezahlt == 'ja' ? d.anzahl : -d.anzahl,
y: "partei",
sort: {y: "x", reverse: true},
fill: "bezahlt",
title: d => `anzahl: ${d.anzahl}`
})),
Plot.text(source, {
x: d => d.bezahlt == 'ja' ? d.anzahl + 10 : -d.anzahl - 10,
y: "partei", text: "anzahl",
// textAnchor: 'end',
}),
Plot.ruleX([0])
],
color: {
type: "categorical",
domain: ['nein', 'ja'],
},
marginLeft: 50,
})
And the result:

Note: Regarding another question I posted this example in #1073
I created a plot looking like a demography chart and set
nice: truefor the X axis. This only appears to affect one end of the axis (the left one in my case). That seems like a bug to me.Here is the example code (without data):
And the result:

Note: Regarding another question I posted this example in #1073