Skip to content

Commit 02a52a6

Browse files
committed
FIX: Make tick dtype int for backwards compatibility
1 parent 4a9105e commit 02a52a6

File tree

2 files changed

+4
-8
lines changed

2 files changed

+4
-8
lines changed

pandas/plotting/_matplotlib/core.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1351,11 +1351,11 @@ def _make_plot(self):
13511351

13521352
if self.orientation == "vertical":
13531353
ax.xaxis.update_units(self.ax_index)
1354-
self.tick_pos = ax.convert_xunits(self.ax_index)
1354+
self.tick_pos = ax.convert_xunits(self.ax_index).astype(np.int)
13551355
self.ax_pos = self.tick_pos - self.tickoffset
13561356
elif self.orientation == "horizontal":
13571357
ax.yaxis.update_units(self.ax_index)
1358-
self.tick_pos = ax.convert_yunits(self.ax_index)
1358+
self.tick_pos = ax.convert_yunits(self.ax_index).astype(np.int)
13591359
self.ax_pos = self.tick_pos - self.tickoffset
13601360

13611361
kwds = self.kwds.copy()

pandas/tests/plotting/test_frame.py

+2-6
Original file line numberDiff line numberDiff line change
@@ -1130,18 +1130,14 @@ def test_bar_categorical(self):
11301130
for df in [df1, df2]:
11311131
ax = df.plot.bar()
11321132
ticks = ax.xaxis.get_ticklocs()
1133-
tm.assert_numpy_array_equal(
1134-
ticks, np.array([0, 1, 2, 3, 4, 5], dtype=np.float)
1135-
)
1133+
tm.assert_numpy_array_equal(ticks, np.array([0, 1, 2, 3, 4, 5]))
11361134
assert ax.get_xlim() == (-0.5, 5.5)
11371135
# check left-edge of bars
11381136
assert ax.patches[0].get_x() == -0.25
11391137
assert ax.patches[-1].get_x() == 5.15
11401138

11411139
ax = df.plot.bar(stacked=True)
1142-
tm.assert_numpy_array_equal(
1143-
ticks, np.array([0, 1, 2, 3, 4, 5], dtype=np.float)
1144-
)
1140+
tm.assert_numpy_array_equal(ticks, np.array([0, 1, 2, 3, 4, 5]))
11451141
assert ax.get_xlim() == (-0.5, 5.5)
11461142
assert ax.patches[0].get_x() == -0.25
11471143
assert ax.patches[-1].get_x() == 4.75

0 commit comments

Comments
 (0)