Skip to content

Commit 8563261

Browse files
committed
Fix example for what's new imshow so it isn't crowded or cut off.
1 parent 13ab5fc commit 8563261

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

doc/users/next_whats_new/imshow_extent_units.rst

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ can now be expressed with units.
1111
from matplotlib.dates import HourLocator, DateFormatter
1212
from matplotlib.ticker import AutoMinorLocator
1313

14-
fig, ax = plt.subplots()
14+
fig, ax = plt.subplots(figsize=(6, 6))
1515
date_first = np.datetime64('2020-01-01', 'D')
1616
date_last = np.datetime64('2020-01-11', 'D')
1717

@@ -20,7 +20,9 @@ can now be expressed with units.
2020
ax.imshow(arr, origin='lower', extent=[1, 11, date_first, date_last])
2121

2222
ax.yaxis.set_major_formatter(DateFormatter('%d/%m/%y:- %H00hours'))
23-
ax.yaxis.set_major_locator(HourLocator(byhour=[0, 6, 12, 18, 24]))
23+
ax.yaxis.set_major_locator(HourLocator(byhour=[0, 12, 24]))
2424
ax.yaxis.set_minor_locator(AutoMinorLocator())
2525

26+
fig.tight_layout()
27+
2628
plt.show()

0 commit comments

Comments
 (0)