HyukjinKwon commented on a change in pull request #35000:
URL: https://github.com/apache/spark/pull/35000#discussion_r775300495
##########
File path: python/pyspark/pandas/plot/matplotlib.py
##########
@@ -383,7 +407,7 @@ def _make_plot(self):
kwds = self._make_plot_keywords(kwds, y)
artists = self._plot(ax, y, column_num=i, stacking_id=stacking_id,
**kwds)
- self._add_legend_handle(artists[0], label, index=i)
+ self._append_legend_handles_labels(artists[0], label)
Review comment:
and maybe:
```suggestion
# Makes plotting compatible with pandas < 1.3, see
pandas-dev/pandas#40078.
self._add_legend_handle(artists[0], label, index=i) if hasattr(
self, "_append_legend_handles_labels"
) else self._append_legend_handles_labels(artists[0], label)
```
##########
File path: python/pyspark/pandas/plot/matplotlib.py
##########
@@ -375,6 +398,7 @@ def _make_plot(self):
kwds = self.kwds.copy()
label = pprint_thing(label if len(label) > 1 else label[0])
+ label = self._mark_right_label(label, index=i)
Review comment:
How about this approach? I think this might be simpler.
```suggestion
# Makes plotting compatible with pandas < 1.3, see
pandas-dev/pandas#40078.
label = self._mark_right_label(
label, index=i) if hasattr(self, "_mark_right_label") else
label
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]