Skip to content

Minor ticklabels are missing at positions of major ticks. #13618

Closed
@ImportanceOfBeingErnest

Description

@ImportanceOfBeingErnest

Bug report

Bug summary

Minor ticklabels are missing at positions of major ticks.

Code for reproduction

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())
ax.xaxis.set_major_formatter(mdates.DateFormatter('\n%a'))

ax.xaxis.set_minor_locator(mdates.HourLocator((0,6,12,18)))
ax.xaxis.set_minor_formatter(mdates.DateFormatter('%H:%M'))

plt.show()

Actual outcome

The above code run with current master produces

image

The minor ticklabels showing the 00:00 hours are missing.

Expected outcome

The expected outcome would be the same as when running the code with matplotlib 3.0.2 or below:

image

I would expect to see the hours throughout.

Matplotlib version

  • Operating system: Win8
  • Matplotlib version: master
  • Matplotlib backend (print(matplotlib.get_backend())): any
  • Python version: 3.6

Metadata

Metadata

Assignees

No one assigned

    Labels

    Release criticalFor bugs that make the library unusable (segfaults, incorrect plots, etc) and major regressions.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions