explicit bar positioning and width
See original GitHub issueThere are a number of use cases for explicit control over bar widths and positions (horizontal and vertical). I’m thinking about this in the context of waterfall plots, irregular-width bars but also times when the auto width is wrong (eg bar positions 1, 3, 5 and you want width 1, not width 2…), complex groupings (a stack of several traces, grouped with another stack of several other traces, etc).
If we allow explicit position and size, that covers every degree of freedom that exists for drawing bars on a plot. Then later we can peel off pieces with more meaning (like complex groupings that we should be able to describe in terms of grouping and stacking rather than positioning), and provide a simpler syntax for those.
I’m thinking of attributes:
// width of bars, in units of the position axis data
// This would override the whole automatic width machinery,
// including bargap and bargroupgap
width: {
valType: 'number',
min: 0,
arrayOk: true
},
// shift on the position axis, in units of the position axis data
// This would override the automatic positioning machinery
// in the case barmode='group', rather than add to it.
offset: {
valType: 'number',
arrayOk: true
}
// shift of the bottom of the bar on the size axis
// This would override the automatic stacking machinery,
// rather than add to it.
base: {
valType: 'any'
arrayOk: true
}
Are offset
and base
clear enough? Any better names? And is width
OK even for horizontal bars (in which case it’s really the bar height)?
Issue Analytics
- State:
- Created 8 years ago
- Reactions:1
- Comments:21 (16 by maintainers)
@AdnanBoota you might just need
layout.bargap
but if you really do need explicit widths on a date axis, you can specify them as milliseconds:
done in https://github.com/plotly/plotly.js/pull/1075