Skip to content

Commit 946af10

Browse files
Merge pull request #11531 from jorisvandenbossche/plot-xticks
BUG: fix incorrect xticklabels when specifying xticks (GH11529)
2 parents d0a2103 + 1796fad commit 946af10

File tree

3 files changed

+9
-2
lines changed

3 files changed

+9
-2
lines changed

doc/source/whatsnew/v0.17.1.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ Bug Fixes
101101

102102

103103

104-
104+
- Fix regression in setting of ``xticks`` in ``plot`` (:issue:`11529`).
105105

106106

107107

pandas/tests/test_graphics.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1237,6 +1237,13 @@ def test_time_series_plot_color_with_empty_kwargs(self):
12371237
ax = s.plot()
12381238
self._check_colors(ax.get_lines(), linecolors=def_colors[:ncolors])
12391239

1240+
def test_xticklabels(self):
1241+
# GH11529
1242+
s = Series(np.arange(10), index=['P%02d' % i for i in range(10)])
1243+
ax = s.plot(xticks=[0,3,5,9])
1244+
exp = ['P%02d' % i for i in [0,3,5,9]]
1245+
self._check_text_labels(ax.get_xticklabels(), exp)
1246+
12401247

12411248
@tm.mplskip
12421249
class TestDataFramePlots(TestPlotBase):

pandas/tools/plotting.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -985,11 +985,11 @@ def generate(self):
985985
self._make_plot()
986986
self._add_table()
987987
self._make_legend()
988+
self._adorn_subplots()
988989

989990
for ax in self.axes:
990991
self._post_plot_logic_common(ax, self.data)
991992
self._post_plot_logic(ax, self.data)
992-
self._adorn_subplots()
993993

994994
def _args_adjust(self):
995995
pass

0 commit comments

Comments
 (0)