Skip to content

Commit 1e75cab

Browse files
committed
Added TestRPlot1 class
1 parent 6ddf053 commit 1e75cab

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

pandas/tests/test_rplot.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
import pandas.tools.rplot as rplot
33
from pandas import read_csv
44
import os
5+
import matplotlib.pyplot as plt
6+
import pdb
57

68
def curpath():
79
pth, _ = os.path.split(os.path.abspath(__file__))
@@ -221,5 +223,19 @@ def test_scale_overflow(self):
221223
for index in range(len(self.data)):
222224
self.scale2(self.data, index)
223225

226+
class TestRPlot1(unittest.TestCase):
227+
def setUp(self):
228+
path = os.path.join(curpath(), 'data/tips.csv')
229+
self.data = read_csv(path, sep=',')
230+
self.plot = rplot.RPlot(self.data, x='tip', y='total_bill')
231+
self.plot + rplot.TrellisGrid(['sex', 'smoker'])
232+
self.plot + rplot.GeomPoint(colour=rplot.ScaleRandomColour('day'), shape=rplot.ScaleShape('size'))
233+
self.fig = plt.gcf()
234+
self.plot.render(self.fig)
235+
pdb.set_trace()
236+
237+
def test_subplots(self):
238+
self.assertEqual(len(self.fig.axes), 4)
239+
224240
if __name__ == '__main__':
225241
unittest.main()

pandas/tools/rplot.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -282,10 +282,10 @@ def make_aes(x=None, y=None, size=None, colour=None, shape=None, alpha=None):
282282
pass
283283
else:
284284
raise ValueError('size mapping should be done through ScaleConstant or ScaleSize')
285-
if any([isinstance(colour, scale) for scale in [ScaleConstant, ScaleGradient, ScaleGradient2]]) or colour is None:
285+
if any([isinstance(colour, scale) for scale in [ScaleConstant, ScaleGradient, ScaleGradient2, ScaleRandomColour]]) or colour is None:
286286
pass
287287
else:
288-
raise ValueError('colour mapping should be done through ScaleConstant, ScaleGradient or ScaleGradient2')
288+
raise ValueError('colour mapping should be done through ScaleConstant, ScaleRandomColour, ScaleGradient or ScaleGradient2')
289289
if any([isinstance(shape, scale) for scale in [ScaleConstant, ScaleShape]]) or shape is None:
290290
pass
291291
else:

0 commit comments

Comments
 (0)