@@ -207,7 +207,7 @@ def normalize(series):
207
207
line = ax .scatter (to_plot [class_ ][0 ],
208
208
to_plot [class_ ][1 ],
209
209
color = random_color (class_ ),
210
- label = str (class_ ), ** kwds )
210
+ label = com . _stringify (class_ ), ** kwds )
211
211
ax .legend ()
212
212
213
213
ax .add_patch (patches .Circle ((0.0 , 0.0 ), radius = 1.0 , facecolor = 'none' ))
@@ -272,8 +272,8 @@ def random_color(column):
272
272
f = function (row )
273
273
y = [f (t ) for t in x ]
274
274
label = None
275
- if str (class_col [i ]) not in used_legends :
276
- label = str (class_col [i ])
275
+ if com . _stringify (class_col [i ]) not in used_legends :
276
+ label = com . _stringify (class_col [i ])
277
277
used_legends .add (label )
278
278
ax .plot (x , y , color = random_color (class_col [i ]), label = label )
279
279
ax .legend (loc = 'upper right' )
@@ -378,8 +378,8 @@ def random_color(column):
378
378
y = row
379
379
label = None
380
380
kls = class_col .iget_value (i )
381
- if str (kls ) not in used_legends :
382
- label = str (kls )
381
+ if com . _stringify (kls ) not in used_legends :
382
+ label = com . _stringify (kls )
383
383
used_legends .add (label )
384
384
ax .plot (x , y , color = random_color (kls ), label = label , ** kwds )
385
385
@@ -685,10 +685,11 @@ def legend_title(self):
685
685
if not isinstance (self .data .columns , MultiIndex ):
686
686
name = self .data .columns .name
687
687
if name is not None :
688
- name = str (name )
688
+ name = com . _stringify (name )
689
689
return name
690
690
else :
691
- stringified = map (str , self .data .columns .names )
691
+ stringified = map (com ._stringify ,
692
+ self .data .columns .names )
692
693
return ',' .join (stringified )
693
694
else :
694
695
return None
@@ -741,13 +742,13 @@ def _get_index_name(self):
741
742
if isinstance (self .data .index , MultiIndex ):
742
743
name = self .data .index .names
743
744
if any (x is not None for x in name ):
744
- name = ',' .join ([str (x ) for x in name ])
745
+ name = ',' .join ([com . _stringify (x ) for x in name ])
745
746
else :
746
747
name = None
747
748
else :
748
749
name = self .data .index .name
749
750
if name is not None :
750
- name = str (name )
751
+ name = com . _stringify (name )
751
752
752
753
return name
753
754
@@ -881,7 +882,7 @@ def _make_plot(self):
881
882
if re .match ('[a-z]+' , style ) is None :
882
883
kwds ['color' ] = colors [i % len (colors )]
883
884
884
- label = com . _stringify (label )
885
+ label = _stringify (label )
885
886
886
887
mask = com .isnull (y )
887
888
if mask .any ():
@@ -1385,9 +1386,9 @@ def plot_group(grouped, ax):
1385
1386
1386
1387
def _stringify (x ):
1387
1388
if isinstance (x , tuple ):
1388
- return '|' .join (str (y ) for y in x )
1389
+ return '|' .join (com . _stringify (y ) for y in x )
1389
1390
else :
1390
- return str (x )
1391
+ return com . _stringify (x )
1391
1392
1392
1393
1393
1394
def format_date_labels (ax , rot ):
@@ -1426,8 +1427,8 @@ def plot_group(group, ax):
1426
1427
else :
1427
1428
fig = ax .get_figure ()
1428
1429
plot_group (data , ax )
1429
- ax .set_ylabel (str (y ))
1430
- ax .set_xlabel (str (x ))
1430
+ ax .set_ylabel (com . _stringify (y ))
1431
+ ax .set_xlabel (com . _stringify (x ))
1431
1432
1432
1433
ax .grid (grid )
1433
1434
@@ -1640,7 +1641,7 @@ def _grouped_plot(plotf, data, column=None, by=None, numeric_only=True,
1640
1641
if numeric_only and isinstance (group , DataFrame ):
1641
1642
group = group ._get_numeric_data ()
1642
1643
plotf (group , ax )
1643
- ax .set_title (str (key ))
1644
+ ax .set_title (com . _stringify (key ))
1644
1645
1645
1646
return fig , axes
1646
1647
@@ -1674,7 +1675,7 @@ def _grouped_plot_by_column(plotf, data, columns=None, by=None,
1674
1675
gp_col = grouped [col ]
1675
1676
plotf (gp_col , ax )
1676
1677
ax .set_title (col )
1677
- ax .set_xlabel (str (by ))
1678
+ ax .set_xlabel (com . _stringify (by ))
1678
1679
ax .grid (grid )
1679
1680
1680
1681
byline = by [0 ] if len (by ) == 1 else by
0 commit comments