We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent fb169e5 commit cd3bd4dCopy full SHA for cd3bd4d
pandas/tests/plotting/frame/test_linecollection_speedup.py
@@ -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