Skip to content

Commit 07f1ce0

Browse files
committed
Added the iris data set example to tests
1 parent 73efc7c commit 07f1ce0

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

pandas/tests/test_rplot.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,5 +254,16 @@ def test_rplot3(self):
254254
self.fig = plt.gcf()
255255
self.plot.render(self.fig)
256256

257+
def test_rplot_iris(self):
258+
path = os.path.join(curpath(), 'data/iris.csv')
259+
plt.figure()
260+
self.data = read_csv(path, sep=',')
261+
plot = rplot.RPlot(self.data, x='SepalLength', y='SepalWidth')
262+
plot + rplot.GeomPoint(colour=rplot.ScaleGradient('PetalLength', colour1=(0.0, 1.0, 0.5), colour2=(1.0, 0.0, 0.5)),
263+
size=rplot.ScaleSize('PetalWidth', min_size=10.0, max_size=200.0),
264+
shape=rplot.ScaleShape('Name'))
265+
self.fig = plt.gcf()
266+
plot.render(self.fig)
267+
257268
if __name__ == '__main__':
258269
unittest.main()

pandas/tools/rplot.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -138,9 +138,9 @@ def __call__(self, data, index):
138138
data: pandas DataFrame
139139
index: pandas DataFrame row index
140140
"""
141-
x = data[column].iget(index)
142-
a = float(min(data[column]))
143-
b = float(max(data[column]))
141+
x = data[self.column].iget(index)
142+
a = float(min(data[self.column]))
143+
b = float(max(data[self.column]))
144144
return self.transform(self.min_size + ((x - a) / (b - a)) *
145145
(self.max_size - self.min_size))
146146

0 commit comments

Comments
 (0)