Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit bc35d13

Browse files
committed
DOC: update the overlapping tick docs
1 parent c5618d7 commit bc35d13

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

doc/api/prev_api_changes/api_changes_3.1.0.rst

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -108,10 +108,11 @@ with ``xaxis.major.locator()``, but ``xaxis.get_minorticklocs()`` does not.
108108
You can control this behavior via the ``.remove_overlap`` attribute on the
109109
minor locator.
110110

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. ::
115116

116117
import numpy as np
117118
import matplotlib.dates as mdates
@@ -128,12 +129,12 @@ ticks::
128129
minor_locator=mdates.HourLocator((0, 6, 12, 18)),
129130
minor_formatter=mdates.DateFormatter("%H:%M"),
130131
)
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
133134
plt.show()
134135

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`).
137138

138139
The major tick labels could also be adjusted include hours and
139140
minutes, as the minor ticks are gone, so the ``major_formatter``

0 commit comments

Comments
 (0)