Skip to content

Commit bcd41e4

Browse files
committed
Fix axisartist.floating_axes error with new NumPy.
It raises "TypeError: Cannot cast ufunc subtract output from dtype('float64') to dtype('int64') with casting rule 'same_kind'" due to in-place subtraction.
1 parent bc1bfab commit bcd41e4

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

lib/mpl_toolkits/axisartist/floating_axes.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -137,12 +137,12 @@ def transform_xy(x, y):
137137

138138
xx1, yy1 = transform_xy(xx0, yy0)
139139

140-
xx00 = xx0.copy()
140+
xx00 = xx0.astype(float, copy=True)
141141
xx00[xx0+dx>xmax] -= dx
142142
xx1a, yy1a = transform_xy(xx00, yy0)
143143
xx1b, yy1b = transform_xy(xx00+dx, yy0)
144144

145-
yy00 = yy0.copy()
145+
yy00 = yy0.astype(float, copy=True)
146146
yy00[yy0+dy>ymax] -= dy
147147
xx2a, yy2a = transform_xy(xx0, yy00)
148148
xx2b, yy2b = transform_xy(xx0, yy00+dy)
@@ -158,12 +158,12 @@ def transform_xy(x, y):
158158
xx1, yy1 = transform_xy(xx0, yy0)
159159

160160

161-
yy00 = yy0.copy()
161+
yy00 = yy0.astype(float, copy=True)
162162
yy00[yy0+dy>ymax] -= dy
163163
xx1a, yy1a = transform_xy(xx0, yy00)
164164
xx1b, yy1b = transform_xy(xx0, yy00+dy)
165165

166-
xx00 = xx0.copy()
166+
xx00 = xx0.astype(float, copy=True)
167167
xx00[xx0+dx>xmax] -= dx
168168
xx2a, yy2a = transform_xy(xx00, yy0)
169169
xx2b, yy2b = transform_xy(xx00+dx, yy0)

0 commit comments

Comments
 (0)