Skip to content

Commit d83e492

Browse files
committed
Changed + to add
1 parent eaf3472 commit d83e492

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

pandas/tests/test_rplot.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -229,8 +229,8 @@ def test_rplot1(self):
229229
plt.figure()
230230
self.data = read_csv(path, sep=',')
231231
self.plot = rplot.RPlot(self.data, x='tip', y='total_bill')
232-
self.plot + rplot.TrellisGrid(['sex', 'smoker'])
233-
self.plot + rplot.GeomPoint(colour=rplot.ScaleRandomColour('day'), shape=rplot.ScaleShape('size'))
232+
self.plot.add(rplot.TrellisGrid(['sex', 'smoker']))
233+
self.plot.add(rplot.GeomPoint(colour=rplot.ScaleRandomColour('day'), shape=rplot.ScaleShape('size')))
234234
self.fig = plt.gcf()
235235
self.plot.render(self.fig)
236236

@@ -239,8 +239,8 @@ def test_rplot2(self):
239239
plt.figure()
240240
self.data = read_csv(path, sep=',')
241241
self.plot = rplot.RPlot(self.data, x='tip', y='total_bill')
242-
self.plot + rplot.TrellisGrid(['.', 'smoker'])
243-
self.plot + rplot.GeomPoint(colour=rplot.ScaleRandomColour('day'), shape=rplot.ScaleShape('size'))
242+
self.plot.add(rplot.TrellisGrid(['.', 'smoker']))
243+
self.plot.add(rplot.GeomPoint(colour=rplot.ScaleRandomColour('day'), shape=rplot.ScaleShape('size')))
244244
self.fig = plt.gcf()
245245
self.plot.render(self.fig)
246246

@@ -249,8 +249,8 @@ def test_rplot3(self):
249249
plt.figure()
250250
self.data = read_csv(path, sep=',')
251251
self.plot = rplot.RPlot(self.data, x='tip', y='total_bill')
252-
self.plot + rplot.TrellisGrid(['sex', '.'])
253-
self.plot + rplot.GeomPoint(colour=rplot.ScaleRandomColour('day'), shape=rplot.ScaleShape('size'))
252+
self.plot.add(rplot.TrellisGrid(['sex', '.']))
253+
self.plot.add(rplot.GeomPoint(colour=rplot.ScaleRandomColour('day'), shape=rplot.ScaleShape('size')))
254254
self.fig = plt.gcf()
255255
self.plot.render(self.fig)
256256

@@ -259,9 +259,9 @@ def test_rplot_iris(self):
259259
plt.figure()
260260
self.data = read_csv(path, sep=',')
261261
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)),
262+
plot.add(rplot.GeomPoint(colour=rplot.ScaleGradient('PetalLength', colour1=(0.0, 1.0, 0.5), colour2=(1.0, 0.0, 0.5)),
263263
size=rplot.ScaleSize('PetalWidth', min_size=10.0, max_size=200.0),
264-
shape=rplot.ScaleShape('Name'))
264+
shape=rplot.ScaleShape('Name')))
265265
self.fig = plt.gcf()
266266
plot.render(self.fig)
267267

pandas/tools/rplot.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -808,16 +808,16 @@ def __init__(self, data, x=None, y=None):
808808
self.layers = [Layer(data, **default_aes(x=x, y=y))]
809809
trellised = False
810810

811-
def __add__(self, other):
811+
def add(self, layer):
812812
"""Add a layer to RPlot instance.
813813
814814
Parameters:
815815
-----------
816-
other: Layer instance
816+
layer: Layer instance
817817
"""
818-
if not isinstance(other, Layer):
818+
if not isinstance(layer, Layer):
819819
raise TypeError("The operand on the right side of + must be a Layer instance")
820-
self.layers.append(other)
820+
self.layers.append(layer)
821821

822822
def render(self, fig=None):
823823
"""Render all the layers on a matplotlib figure.

0 commit comments

Comments
 (0)