Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit e94428b

Browse filesBrowse files
committed
Simplify example.
1 parent fb6890b commit e94428b
Copy full SHA for e94428b

File tree

Expand file treeCollapse file tree

1 file changed

+2
-12
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+2
-12
lines changed

‎doc/users/next_whats_new/imshow_extent_units.rst

Copy file name to clipboardExpand all lines: doc/users/next_whats_new/imshow_extent_units.rst
+2-12Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@ can now be expressed with units.
88

99
import matplotlib.pyplot as plt
1010
import numpy as np
11-
from matplotlib.dates import HourLocator, ConciseDateFormatter
12-
from matplotlib.ticker import AutoMinorLocator
11+
from matplotlib.dates import DateFormatter
1312

1413
fig, ax = plt.subplots(layout='constrained')
1514
date_first = np.datetime64('2020-01-01', 'D')
@@ -19,15 +18,6 @@ can now be expressed with units.
1918

2019
ax.imshow(arr, origin='lower', extent=[1, 11, date_first, date_last])
2120

22-
# customize tick locations and labels
23-
locator = HourLocator(byhour=[0, 12])
24-
ax.yaxis.set_major_formatter(
25-
ConciseDateFormatter(
26-
locator, show_offset=False,
27-
zero_formats=['', '%Y', '%b', '%b-%d %H:%M', '%H:%M', '%H:%M']
28-
)
29-
)
30-
ax.yaxis.set_major_locator(locator)
31-
ax.yaxis.set_minor_locator(AutoMinorLocator())
21+
ax.yaxis.set_major_formatter(DateFormatter('%d/%m/%y'))
3222

3323
plt.show()

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.