Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 996976a

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 0de4775 commit 996976a

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
@@ -140,12 +140,12 @@ def transform_xy(x, y):
140140

141141
xx1, yy1 = transform_xy(xx0, yy0)
142142

143-
xx00 = xx0.copy()
143+
xx00 = xx0.astype(float, copy=True)
144144
xx00[xx0+dx>xmax] -= dx
145145
xx1a, yy1a = transform_xy(xx00, yy0)
146146
xx1b, yy1b = transform_xy(xx00+dx, yy0)
147147

148-
yy00 = yy0.copy()
148+
yy00 = yy0.astype(float, copy=True)
149149
yy00[yy0+dy>ymax] -= dy
150150
xx2a, yy2a = transform_xy(xx0, yy00)
151151
xx2b, yy2b = transform_xy(xx0, yy00+dy)
@@ -161,12 +161,12 @@ def transform_xy(x, y):
161161
xx1, yy1 = transform_xy(xx0, yy0)
162162

163163

164-
yy00 = yy0.copy()
164+
yy00 = yy0.astype(float, copy=True)
165165
yy00[yy0+dy>ymax] -= dy
166166
xx1a, yy1a = transform_xy(xx0, yy00)
167167
xx1b, yy1b = transform_xy(xx0, yy00+dy)
168168

169-
xx00 = xx0.copy()
169+
xx00 = xx0.astype(float, copy=True)
170170
xx00[xx0+dx>xmax] -= dx
171171
xx2a, yy2a = transform_xy(xx00, yy0)
172172
xx2b, yy2b = transform_xy(xx00+dx, yy0)

0 commit comments

Comments
 (0)