Skip to content

Commit 5d52e10

Browse files
author
Chang She
committed
TST: test case for using frame column names in legend title f826c0e
1 parent 4d9238c commit 5d52e10

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

pandas/tests/test_graphics.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,17 @@ def test_plot_int_columns(self):
229229
df = DataFrame(np.random.randn(100, 4)).cumsum()
230230
_check_plot_works(df.plot, legend=True)
231231

232+
@slow
233+
def test_legend_name(self):
234+
multi = DataFrame(np.random.randn(4, 4),
235+
columns=[np.array(['a', 'a', 'b', 'b']),
236+
np.array(['x', 'y', 'x', 'y'])])
237+
multi.columns.names = ['group', 'individual']
238+
239+
ax = multi.plot()
240+
leg_title = ax.legend_.get_title()
241+
self.assert_(leg_title.get_text(), 'group,individual')
242+
232243
def _check_plot_fails(self, f, *args, **kwargs):
233244
self.assertRaises(Exception, f, *args, **kwargs)
234245

0 commit comments

Comments
 (0)