Fix regression with matplotlib 3.7.0 · python-control/python-control@4c4b3fc

@@ -1024,9 +1024,11 @@ def _parse_linestyle(style_name, allow_false=False):

10241024

# Plot the scaled sections of the curve (changing linestyle)

10251025

x_scl = np.ma.masked_where(scale_mask, resp.real)

10261026

y_scl = np.ma.masked_where(scale_mask, resp.imag)

1027-

plt.plot(

1028-

x_scl * (1 + curve_offset), y_scl * (1 + curve_offset),

1029-

primary_style[1], color=c, **kwargs)

1027+

if x_scl.count() >= 1 and y_scl.count() >= 1:

1028+

plt.plot(

1029+

x_scl * (1 + curve_offset),

1030+

y_scl * (1 + curve_offset),

1031+

primary_style[1], color=c, **kwargs)

1030103210311033

# Plot the primary curve (invisible) for setting arrows

10321034

x, y = resp.real.copy(), resp.imag.copy()

@@ -1044,10 +1046,11 @@ def _parse_linestyle(style_name, allow_false=False):

10441046

# Plot the regular and scaled segments

10451047

plt.plot(

10461048

x_reg, -y_reg, mirror_style[0], color=c, **kwargs)

1047-

plt.plot(

1048-

x_scl * (1 - curve_offset),

1049-

-y_scl * (1 - curve_offset),

1050-

mirror_style[1], color=c, **kwargs)

1049+

if x_scl.count() >= 1 and y_scl.count() >= 1:

1050+

plt.plot(

1051+

x_scl * (1 - curve_offset),

1052+

-y_scl * (1 - curve_offset),

1053+

mirror_style[1], color=c, **kwargs)

1051105410521055

# Add the arrows (on top of an invisible contour)

10531056

x, y = resp.real.copy(), resp.imag.copy()