Skip to content

Commit 2fc54ef

Browse files
committed
fix: replace np.float_ with np.float64 for numpy 2.0 compatibility
Issue nschloe#621: Replace np.float_ with np.float64 for np 2.0 - numpy 2.0 removed np.float_, use np.float64 instead This PR has been tested locally.
1 parent 450712b commit 2fc54ef

1 file changed

Lines changed: 12 additions & 12 deletions

File tree

src/tikzplotlib/_legend.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -117,40 +117,40 @@ def _get_location_from_best(obj):
117117
# (or center) of the axes box.
118118
# 1. Key points of the legend
119119
lower_left_legend = x0_legend
120-
lower_right_legend = np.array([x1_legend[0], x0_legend[1]], dtype=np.float_)
121-
upper_left_legend = np.array([x0_legend[0], x1_legend[1]], dtype=np.float_)
120+
lower_right_legend = np.array([x1_legend[0], x0_legend[1]], dtype=np.float64)
121+
upper_left_legend = np.array([x0_legend[0], x1_legend[1]], dtype=np.float64)
122122
upper_right_legend = x1_legend
123123
center_legend = x0_legend + dimension_legend / 2.0
124124
center_left_legend = np.array(
125-
[x0_legend[0], x0_legend[1] + dimension_legend[1] / 2.0], dtype=np.float_
125+
[x0_legend[0], x0_legend[1] + dimension_legend[1] / 2.0], dtype=np.float64
126126
)
127127
center_right_legend = np.array(
128-
[x1_legend[0], x0_legend[1] + dimension_legend[1] / 2.0], dtype=np.float_
128+
[x1_legend[0], x0_legend[1] + dimension_legend[1] / 2.0], dtype=np.float64
129129
)
130130
lower_center_legend = np.array(
131-
[x0_legend[0] + dimension_legend[0] / 2.0, x0_legend[1]], dtype=np.float_
131+
[x0_legend[0] + dimension_legend[0] / 2.0, x0_legend[1]], dtype=np.float64
132132
)
133133
upper_center_legend = np.array(
134-
[x0_legend[0] + dimension_legend[0] / 2.0, x1_legend[1]], dtype=np.float_
134+
[x0_legend[0] + dimension_legend[0] / 2.0, x1_legend[1]], dtype=np.float64
135135
)
136136

137137
# 2. Key points of the axes
138138
lower_left_axes = x0_axes
139-
lower_right_axes = np.array([x1_axes[0], x0_axes[1]], dtype=np.float_)
140-
upper_left_axes = np.array([x0_axes[0], x1_axes[1]], dtype=np.float_)
139+
lower_right_axes = np.array([x1_axes[0], x0_axes[1]], dtype=np.float64)
140+
upper_left_axes = np.array([x0_axes[0], x1_axes[1]], dtype=np.float64)
141141
upper_right_axes = x1_axes
142142
center_axes = x0_axes + dimension_axes / 2.0
143143
center_left_axes = np.array(
144-
[x0_axes[0], x0_axes[1] + dimension_axes[1] / 2.0], dtype=np.float_
144+
[x0_axes[0], x0_axes[1] + dimension_axes[1] / 2.0], dtype=np.float64
145145
)
146146
center_right_axes = np.array(
147-
[x1_axes[0], x0_axes[1] + dimension_axes[1] / 2.0], dtype=np.float_
147+
[x1_axes[0], x0_axes[1] + dimension_axes[1] / 2.0], dtype=np.float64
148148
)
149149
lower_center_axes = np.array(
150-
[x0_axes[0] + dimension_axes[0] / 2.0, x0_axes[1]], dtype=np.float_
150+
[x0_axes[0] + dimension_axes[0] / 2.0, x0_axes[1]], dtype=np.float64
151151
)
152152
upper_center_axes = np.array(
153-
[x0_axes[0] + dimension_axes[0] / 2.0, x1_axes[1]], dtype=np.float_
153+
[x0_axes[0] + dimension_axes[0] / 2.0, x1_axes[1]], dtype=np.float64
154154
)
155155

156156
# 3. Compute the distances between comparable points.

0 commit comments

Comments
 (0)