Skip to content

Commit cd3bd4d

Browse files
author
evgenii
committed
TST: use default_rng to satisfy Ruff NPY002
1 parent fb169e5 commit cd3bd4d

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
"""
2+
Ensure wide DataFrame.line plots use a single LineCollection
3+
instead of one Line2D per column (PR #61764).
4+
"""
5+
6+
from matplotlib.collections import LineCollection
7+
import matplotlib.pyplot as plt
8+
import numpy as np
9+
10+
import pandas as pd
11+
12+
13+
def test_linecollection_used_for_wide_dataframe():
14+
rng = np.random.default_rng(0)
15+
df = pd.DataFrame(rng.standard_normal((10, 201)).cumsum(axis=0))
16+
17+
ax = df.plot(legend=False)
18+
19+
# one LineCollection, zero Line2D objects
20+
assert sum(isinstance(c, LineCollection) for c in ax.collections) == 1
21+
assert len(ax.lines) == 0
22+
23+
plt.close(ax.figure)

0 commit comments

Comments
 (0)