@@ -108,10 +108,11 @@ with ``xaxis.major.locator()``, but ``xaxis.get_minorticklocs()`` does not.
108
108
You can control this behavior via the ``.remove_overlap `` attribute on the
109
109
minor locator.
110
110
111
- If you were relying on both the major and minor tick labels to appear on the
112
- same tick, you may need to update your code. For example, the following
113
- snippet labeled days using major ticks, and hours and minutes using minor
114
- ticks::
111
+ If you were relying on both the major and minor tick labels to appear
112
+ on the same tick, you may need to update your code. For example, the
113
+ following snippet labeled days using major ticks, and hours and
114
+ minutes using minor ticks and added a newline to the major ticks
115
+ labels to avoid them crashing into the minor tick labels. ::
115
116
116
117
import numpy as np
117
118
import matplotlib.dates as mdates
@@ -128,12 +129,12 @@ ticks::
128
129
minor_locator=mdates.HourLocator((0, 6, 12, 18)),
129
130
minor_formatter=mdates.DateFormatter("%H:%M"),
130
131
)
131
- # disables tick collision suppression
132
- ax.axis.minor.locator.remove_overlap = False
132
+ # disable removing overlapping ticks by adding this line
133
+ ax.xaxis.remove_overlapping_locs = False
133
134
plt.show()
134
135
135
- and added a newline to the major ticks labels to avoid them crashing into the
136
- minor tick labels .
136
+ Setting the ` Axis.remove_overlapping_locs ` property (also available
137
+ via ` Axis.set_remove_overlapping_locs ` and ` ~pyplot.setp `) .
137
138
138
139
The major tick labels could also be adjusted include hours and
139
140
minutes, as the minor ticks are gone, so the ``major_formatter ``
0 commit comments