diff --git a/examples/ticks_and_spines/centered_ticklabels.py b/examples/ticks_and_spines/centered_ticklabels.py index 3e59f2966f4a..308ac3bb1121 100644 --- a/examples/ticks_and_spines/centered_ticklabels.py +++ b/examples/ticks_and_spines/centered_ticklabels.py @@ -7,7 +7,8 @@ associates a label with a tick, and the label can be aligned 'center', 'left', or 'right' using the horizontal alignment property:: - ax.xaxis.set_tick_params(horizontalalignment='right') + for label in ax.xaxis.get_xticklabels(): + label.set_horizontalalignment('right') but this doesn't help center the label between ticks. One solution is to "fake it". Use the minor ticks to place a tick centered