diff --git a/doc/api/next_api_changes/2018-01-30-AL.rst b/doc/api/next_api_changes/2018-01-30-AL.rst index 512cdbfbc764..6b9479f6db49 100644 --- a/doc/api/next_api_changes/2018-01-30-AL.rst +++ b/doc/api/next_api_changes/2018-01-30-AL.rst @@ -1,10 +1,40 @@ -Minor Locator no longer try to avoid overstriking major Locators -```````````````````````````````````````````````````````````````` +Minor ticks that collide with major ticks are always hidden +``````````````````````````````````````````````````````````` Previously, certain locator classes (`LogLocator`, `AutoMinorLocator`) contained custom logic to avoid emitting tick locations that collided with major ticks when they were used as minor locators. -This logic has now moved to the Axis class; thus, for example, -``xaxis.minor.locator()`` now includes positions that collide with -``xaxis.major.locator()``, but ``xaxis.get_minorticklocs()`` does not. +This logic has now moved to the Axis class, and is used *regardless of the +ticker class*. ``xaxis.minor.locator()`` now includes positions that collide +with ``xaxis.major.locator()``, but ``xaxis.get_minorticklocs()`` does not. + +If you were relying on both the major and minor tick labels to appear on the +same tick, you may need to update your code. For example, the following +snippet labeled days using major ticks, and hours and minutes using minor +ticks:: + + import numpy as np + import matplotlib.dates as mdates + import matplotlib.pyplot as plt + + t = np.arange("2018-11-03", "2018-11-06", dtype="datetime64") + x = np.random.rand(len(t)) + + fig, ax = plt.subplots() + ax.plot(t, x) + ax.xaxis.set( + major_locator=mdates.DayLocator(), + major_formatter=mdates.DateFormatter("\n%a"), + minor_locator=mdates.HourLocator((0, 6, 12, 18)), + minor_formatter=mdates.DateFormatter("%H:%M"), + ) + + plt.show() + +and added a newline to the major ticks labels to avoid them crashing into the +minor tick labels. + +With the API change, the major tick labels should also include hours and +minutes, as the minor ticks are gone, so the ``major_formatter`` should be +``mdates.DateFormatter("%H:%M\n%a")``. pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy