Skip to content

Commit daf445c

Browse files
committed
FIX: Make tick dtype int for backwards compatibility
1 parent fd3f100 commit daf445c

File tree

2 files changed

+4
-8
lines changed

2 files changed

+4
-8
lines changed

pandas/plotting/_matplotlib/core.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1360,11 +1360,11 @@ def _make_plot(self):
13601360

13611361
if self.orientation == "vertical":
13621362
ax.xaxis.update_units(self.ax_index)
1363-
self.tick_pos = ax.convert_xunits(self.ax_index)
1363+
self.tick_pos = ax.convert_xunits(self.ax_index).astype(np.int)
13641364
self.ax_pos = self.tick_pos - self.tickoffset
13651365
elif self.orientation == "horizontal":
13661366
ax.yaxis.update_units(self.ax_index)
1367-
self.tick_pos = ax.convert_yunits(self.ax_index)
1367+
self.tick_pos = ax.convert_yunits(self.ax_index).astype(np.int)
13681368
self.ax_pos = self.tick_pos - self.tickoffset
13691369

13701370
kwds = self.kwds.copy()

pandas/tests/plotting/test_frame.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1128,18 +1128,14 @@ def test_bar_categorical(self):
11281128
for df in [df1, df2]:
11291129
ax = df.plot.bar()
11301130
ticks = ax.xaxis.get_ticklocs()
1131-
tm.assert_numpy_array_equal(
1132-
ticks, np.array([0, 1, 2, 3, 4, 5], dtype=np.float)
1133-
)
1131+
tm.assert_numpy_array_equal(ticks, np.array([0, 1, 2, 3, 4, 5]))
11341132
assert ax.get_xlim() == (-0.5, 5.5)
11351133
# check left-edge of bars
11361134
assert ax.patches[0].get_x() == -0.25
11371135
assert ax.patches[-1].get_x() == 5.15
11381136

11391137
ax = df.plot.bar(stacked=True)
1140-
tm.assert_numpy_array_equal(
1141-
ticks, np.array([0, 1, 2, 3, 4, 5], dtype=np.float)
1142-
)
1138+
tm.assert_numpy_array_equal(ticks, np.array([0, 1, 2, 3, 4, 5]))
11431139
assert ax.get_xlim() == (-0.5, 5.5)
11441140
assert ax.patches[0].get_x() == -0.25
11451141
assert ax.patches[-1].get_x() == 4.75

0 commit comments

Comments
 (0)