Skip to content

Commit 4f23d61

Browse files
committed
TST: add smoke test for pcolormesh + pandas + dates
1 parent b30cd83 commit 4f23d61

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

lib/matplotlib/tests/test_axes.py

+30
Original file line numberDiff line numberDiff line change
@@ -1657,6 +1657,36 @@ def test_boxplot_dates_pandas(pd):
16571657
plt.boxplot(data, positions=years)
16581658

16591659

1660+
def test_pcolor_regression(pd):
1661+
from pandas.plotting import (
1662+
register_matplotlib_converters,
1663+
deregister_matplotlib_converters,
1664+
)
1665+
1666+
fig = plt.figure()
1667+
ax = fig.add_subplot(111)
1668+
1669+
times = [datetime.datetime(2021, 1, 1)]
1670+
while len(times) < 7:
1671+
times.append(times[-1] + datetime.timedelta(seconds=120))
1672+
1673+
y_vals = np.arange(5)
1674+
1675+
time_axis, y_axis = np.meshgrid(times, y_vals)
1676+
shape = (len(y_vals) - 1, len(times) - 1)
1677+
z_data = np.arange(shape[0] * shape[1])
1678+
1679+
z_data.shape = shape
1680+
try:
1681+
register_matplotlib_converters()
1682+
1683+
im = ax.pcolormesh(time_axis, y_axis, z_data)
1684+
# make sure this does not raise!
1685+
fig.canvas.draw()
1686+
finally:
1687+
deregister_matplotlib_converters()
1688+
1689+
16601690
def test_bar_pandas(pd):
16611691
# Smoke test for pandas
16621692
df = pd.DataFrame(

0 commit comments

Comments
 (0)