Skip to content

Commit ca311b5

Browse files
committed
add test
1 parent f330831 commit ca311b5

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

pandas/tests/plotting/test_frame.py

+17
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,23 @@ def test_plot(self):
139139
result = ax.get_axes() # deprecated
140140
assert result is axes[0]
141141

142+
# GH 18726
143+
def test_two_plots_with_x_str(self):
144+
x1, y1 = ['a', 'b'], [1, 2]
145+
x2, y2 = ['b', 'a'], [4, 3]
146+
df1 = pd.DataFrame(y1, index=x1)
147+
df2 = pd.DataFrame(y2, index=x2)
148+
ax = None
149+
ax = df1.plot(ax=ax)
150+
ax = df2.plot(ax=ax)
151+
152+
line1, line2 = ax.lines
153+
# xdata should not be touched (Earlier it was [0, 1])
154+
np.testing.assert_equal(line1.get_xdata(), x1)
155+
np.testing.assert_equal(line1.get_ydata(), y1)
156+
np.testing.assert_equal(line2.get_xdata(), x2)
157+
np.testing.assert_equal(line2.get_ydata(), y2)
158+
142159
# GH 15516
143160
def test_mpl2_color_cycle_str(self):
144161
# test CN mpl 2.0 color cycle

0 commit comments

Comments
 (0)