Skip to content

Commit 3adfe68

Browse files
committed
PERF: add asv benchmarks for uncovered plotting methods
1 parent b7294dd commit 3adfe68

File tree

1 file changed

+41
-11
lines changed

1 file changed

+41
-11
lines changed

asv_bench/benchmarks/plotting.py

Lines changed: 41 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,47 @@
88
matplotlib.use('Agg')
99

1010

11-
class Plotting(object):
12-
13-
def setup(self):
14-
self.s = Series(np.random.randn(1000000))
15-
self.df = DataFrame({'col': self.s})
16-
17-
def time_series_plot(self):
18-
self.s.plot()
19-
20-
def time_frame_plot(self):
21-
self.df.plot()
11+
class SeriesPlotting(object):
12+
params = [['line', 'bar', 'area', 'barh', 'hist', 'kde', 'pie']]
13+
param_names = ['kind']
14+
15+
def setup(self, kind):
16+
if kind in ['bar', 'barh', 'pie']:
17+
n = 100
18+
elif kind in ['kde']:
19+
n = 10000
20+
else:
21+
n = 1000000
22+
23+
self.s = Series(np.random.randn(n))
24+
if kind in ['area', 'pie']:
25+
self.s = self.s.abs()
26+
27+
def time_series_plot(self, kind):
28+
self.s.plot(kind=kind)
29+
30+
31+
class FramePlotting(object):
32+
params = [['line', 'bar', 'area', 'barh', 'hist', 'kde', 'pie', 'scatter', 'hexbin']]
33+
param_names = ['kind']
34+
35+
def setup(self, kind):
36+
if kind in ['bar', 'barh', 'pie']:
37+
n = 100
38+
elif kind in ['kde', 'scatter', 'hexbin']:
39+
n = 10000
40+
else:
41+
n = 1000000
42+
43+
self.x = Series(np.random.randn(n))
44+
self.y = Series(np.random.randn(n))
45+
if kind in ['area', 'pie']:
46+
self.x = self.x.abs()
47+
self.y = self.y.abs()
48+
self.df = DataFrame({'x': self.x, 'y': self.y})
49+
50+
def time_frame_plot(self, kind):
51+
self.df.plot(x='x', y='y', kind=kind)
2252

2353

2454
class TimeseriesPlotting(object):

0 commit comments

Comments
 (0)