Skip to content

Commit 7cea50a

Browse files
author
nicolas.rebena
committed
1 parent 2e732b1 commit 7cea50a

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
@@ -2995,6 +2995,23 @@ def test_secondary_axis_font_size(self, method):
29952995
self._check_ticks_props(axes=ax.right_ax,
29962996
ylabelsize=fontsize)
29972997

2998+
@pytest.mark.slow
2999+
def test_x_string_values_ticks(self):
3000+
# GH: 7612
3001+
# GH: 22334
3002+
# GH: 15912
3003+
df = pd.DataFrame({'sales': [3, 2, 3],
3004+
'visits': [20, 42, 28],
3005+
'day': ['Monday', 'Tuesday', 'Wednesday']})
3006+
ax = df.plot.area(x='day')
3007+
ax.set_xlim(-1, 3)
3008+
xticklabels = [t.get_text() for t in ax.get_xticklabels()]
3009+
labels_position = dict(zip(xticklabels, ax.get_xticks()))
3010+
# Testing if the label stayed at the right position
3011+
assert labels_position['Monday'] == 0.0
3012+
assert labels_position['Tuesday'] == 1.0
3013+
assert labels_position['Wednesday'] == 2.0
3014+
29983015

29993016
def _generate_4_axes_via_gridspec():
30003017
import matplotlib.pyplot as plt

0 commit comments

Comments
 (0)