8000 Avoid unnecessary conversions to arrays. · matplotlib/matplotlib@00ab15a · GitHub
[go: up one dir, main page]

Skip to content

Commit 00ab15a

Browse files
committed
Avoid unnecessary conversions to arrays.
These inputs may be ragged, but we only just need to know the length of the items. There's no need to make an array to check that.
1 parent a31a7e0 commit 00ab15a

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

lib/matplotlib/axes/_axes.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3765,7 +3765,7 @@ def boxplot(self, x, notch=None, sym=None, vert=None, whis=None,
37653765
stats['med'] = med
37663766

37673767
if conf_intervals is not None:
3768-
if np.shape(conf_intervals)[0] != len(bxpstats):
3768+
if len(conf_intervals) != len(bxpstats):
37693769
raise ValueError(
37703770
"'conf_intervals' and 'x' have different lengths")
37713771
else:

lib/matplotlib/tests/test_backend_svg.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,8 @@ def include(gid, obj):
191191
elif obj.axes is None:
192192
return False
193193
if isinstance(obj, plt.Line2D):
194-
if np.array(obj.get_data()).shape == (2, 1):
194+
xdata, ydata = obj.get_data()
195+
if len(xdata) == len(ydata) == 1:
195196
return False
196197
elif not hasattr(obj, "axes") or obj.axes is None:
197198
return False

0 commit comments

Comments
 (0)
0