Skip to content

[Bug]: ConciseDateFormatter not showing offset #21670

@Stassels

Description

@Stassels

Bug summary

When I create time series plot with too big time range, I can't see offset in lower right corner.

Code for reproduction

import numpy as np
import pandas as pd
import matplotlib.pyplot as plt

LEN = 40000
dt_index = pd.date_range('2013-01-01 00:00', periods=LEN, freq='5min')
df = pd.DataFrame({'data': np.random.randint(10, size=LEN)},index=dt_index)

fig, ax = plt.subplots()
import matplotlib.dates as mdates

locator = mdates.AutoDateLocator()
formatter = mdates.ConciseDateFormatter(locator)
ax.xaxis.set_major_locator(locator)
ax.xaxis.set_major_formatter(formatter)

ax.plot(df.index, df.data)

plt.show()

Actual outcome

image

Expected outcome

image

Additional information

When changing time range with fewer points, I can see the offset as seen in expected outcome.

Operating system

Ubuntu

Matplotlib Version

3.4.3

Matplotlib Backend

Qt5Agg

Python version

3.9

Jupyter version

No response

Installation

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions