In D3, you can return the width between two bands with band.bandwidth().
Is there an equivalent to this for d3.scaleLinear() for your given domain, provided you've set the ticks on an axis?
So if your tickValues domain is [-2,-1,0,1,2], scaleLinear.tickWidth() would provide you with the difference between scaleLinear(0) and scaleLinear(1) (or scaleLinear(-2) and scaleLinear(-1)), or whatever you've set the difference between the ticks to be.