Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

Commit1fa7467

Browse files
authored
Merge pull request#24441 from stefmolin/imshow-extent-cutoff-whatsnew
DOC: Fix example for what's new imshow so it isn't cut off or crowded.
2 parents686aab6 +bd83031 commit1fa7467

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

‎doc/users/next_whats_new/imshow_extent_units.rst

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,13 @@ can now be expressed with units.
88

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

14-
fig, ax = plt.subplots()
12+
fig, ax = plt.subplots(layout='constrained')
1513
date_first = np.datetime64('2020-01-01', 'D')
1614
date_last = np.datetime64('2020-01-11', 'D')
1715

1816
arr = [[i+j for i in range(10)] for j in range(10)]
1917

20-
ax.imshow(arr, origin='lower', extent=[1, 11, date_first, date_last])
21-
22-
ax.yaxis.set_major_formatter(DateFormatter('%d/%m/%y:- %H00hours'))
23-
ax.yaxis.set_major_locator(HourLocator(byhour=[0, 6, 12, 18, 24]))
24-
ax.yaxis.set_minor_locator(AutoMinorLocator())
18+
ax.imshow(arr, origin='lower', extent=[0, 10, date_first, date_last])
2519

2620
plt.show()

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp