Skip to content

Commit cabcf8f

Browse files
committed
Replace np.float_ with np.float64 for np 2.0
This avoids ``` AttributeError: `np.float_` was removed in the NumPy 2.0 release. Use `np.float64` instead. ```
1 parent 788f3d3 commit cabcf8f

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

src/tikzplotlib/_legend.py

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

140140
# 2. Key points of the axes
141141
lower_left_axes = x0_axes
142-
lower_right_axes = np.array([x1_axes[0], x0_axes[1]], dtype=np.float_)
143-
upper_left_axes = np.array([x0_axes[0], x1_axes[1]], dtype=np.float_)
142+
lower_right_axes = np.array([x1_axes[0], x0_axes[1]], dtype=np.float64)
143+
upper_left_axes = np.array([x0_axes[0], x1_axes[1]], dtype=np.float64)
144144
upper_right_axes = x1_axes
145145
center_axes = x0_axes + dimension_axes / 2.0
146146
center_left_axes = np.array(
147-
[x0_axes[0], x0_axes[1] + dimension_axes[1] / 2.0], dtype=np.float_
147+
[x0_axes[0], x0_axes[1] + dimension_axes[1] / 2.0], dtype=np.float64
148148
)
149149
center_right_axes = np.array(
150-
[x1_axes[0], x0_axes[1] + dimension_axes[1] / 2.0], dtype=np.float_
150+
[x1_axes[0], x0_axes[1] + dimension_axes[1] / 2.0], dtype=np.float64
151151
)
152152
lower_center_axes = np.array(
153-
[x0_axes[0] + dimension_axes[0] / 2.0, x0_axes[1]], dtype=np.float_
153+
[x0_axes[0] + dimension_axes[0] / 2.0, x0_axes[1]], dtype=np.float64
154154
)
155155
upper_center_axes = np.array(
156-
[x0_axes[0] + dimension_axes[0] / 2.0, x1_axes[1]], dtype=np.float_
156+
[x0_axes[0] + dimension_axes[0] / 2.0, x1_axes[1]], dtype=np.float64
157157
)
158158

159159
# 3. Compute the distances between comparable points.

0 commit comments

Comments
 (0)