Skip to content

Commit 57d7a7b

Browse files
committed
PERF: add asv benchmarks for uncovered plotting methods
1 parent ee283fa commit 57d7a7b

File tree

1 file changed

+42
-11
lines changed

1 file changed

+42
-11
lines changed

asv_bench/benchmarks/plotting.py

Lines changed: 42 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,48 @@
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',
33+
'hexbin']]
34+
param_names = ['kind']
35+
36+
def setup(self, kind):
37+
if kind in ['bar', 'barh', 'pie']:
38+
n = 100
39+
elif kind in ['kde', 'scatter', 'hexbin']:
40+
n = 10000
41+
else:
42+
n = 1000000
43+
44+
self.x = Series(np.random.randn(n))
45+
self.y = Series(np.random.randn(n))
46+
if kind in ['area', 'pie']:
47+
self.x = self.x.abs()
48+
self.y = self.y.abs()
49+
self.df = DataFrame({'x': self.x, 'y': self.y})
50+
51+
def time_frame_plot(self, kind):
52+
self.df.plot(x='x', y='y', kind=kind)
2253

2354

2455
class TimeseriesPlotting(object):

0 commit comments

Comments
 (0)