@@ -276,18 +276,21 @@ def bode_plot(syslist, omega=None,
276
276
if initial_phase is None :
277
277
# Start phase in the range 0 to -360 w/ initial phase = -180
278
278
# If wrap_phase is true, use 0 instead (phase \in (-pi, pi])
279
- initial_phase = - math .pi if wrap_phase is not True else 0
279
+ initial_phase_value = - math .pi if wrap_phase is not True else 0
280
280
elif isinstance (initial_phase , (int , float )):
281
281
# Allow the user to override the default calculation
282
282
if deg :
283
- initial_phase = initial_phase / 180. * math .pi
283
+ initial_phase_value = initial_phase / 180. * math .pi
284
+ else :
285
+ initial_phase_value = initial_phase
286
+
284
287
else :
285
288
raise ValueError ("initial_phase must be a number." )
286
289
287
290
# Shift the phase if needed
288
- if abs (phase [0 ] - initial_phase ) > math .pi :
291
+ if abs (phase [0 ] - initial_phase_value ) > math .pi :
289
292
phase -= 2 * math .pi * \
290
- round ((phase [0 ] - initial_phase ) / (2 * math .pi ))
293
+ round ((phase [0 ] - initial_phase_value ) / (2 * math .pi ))
291
294
292
295
# Phase wrapping
293
296
if wrap_phase is False :
@@ -1021,9 +1024,11 @@ def _parse_linestyle(style_name, allow_false=False):
1021
1024
# Plot the scaled sections of the curve (changing linestyle)
1022
1025
x_scl = np .ma .masked_where (scale_mask , resp .real )
1023
1026
y_scl = np .ma .masked_where (scale_mask , resp .imag )
1024
- plt .plot (
1025
- x_scl * (1 + curve_offset ), y_scl * (1 + curve_offset ),
1026
- 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 )
1027
1032
1028
1033
# Plot the primary curve (invisible) for setting arrows
1029
1034
x , y = resp .real .copy (), resp .imag .copy ()
@@ -1041,10 +1046,11 @@ def _parse_linestyle(style_name, allow_false=False):
1041
1046
# Plot the regular and scaled segments
1042
1047
plt .plot (
1043
1048
x_reg , - y_reg , mirror_style [0 ], color = c , ** kwargs )
1044
- plt .plot (
1045
- x_scl * (1 - curve_offset ),
1046
- - y_scl * (1 - curve_offset ),
1047
- 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 )
1048
1054
1049
1055
# Add the arrows (on top of an invisible contour)
1050
1056
x , y = resp .real .copy (), resp .imag .copy ()
0 commit comments