Closed
Description
Bug report
Bug summary
The axes range is not correctly extended when using set_xticks
with not-yet-present categoricals.
Semi-related to #12993.
Code for reproduction
fig, ((ax1, ax2), (ax3, ax4)) = plt.subplots(2, 2)
ax1.bar(['a', 'b'], [1 , 2])
ax2.bar(['a', 'b'], [1 , 2])
ax3.bar(['a', 'b'], [1 , 2])
ax4.bar(['a', 'b'], [1 , 2])
ax1.set_xticks(['b'])
ax2.set_xticks(['b', 'c'])
ax3.set_xticks(['c'])
ax4.set_xticks(['b', 'c', 'd'])
- ax1 is correct.
- ax3 is missing the 'c' label completely.
- For ax2 and ax4, the x-range should be 0.5 larger so that the label is not at the edge.