@@ -1081,9 +1081,14 @@ def singular_values_plot(syslist, omega=None,
10811081 >>> den = [75, 1]
10821082 >>> sys = ct.tf([[[87.8], [-86.4]], [[108.2], [-109.6]]], [[den, den], [den, den]])
10831083 >>> omega = np.logspace(-4, 1, 1000)
1084- >>> sigma, omega = singular_values_plot(sys)
1084+ >>> sigma, omega = singular_values_plot(sys, plot=True)
1085+ >>> singular_values_plot(sys, 0.0, plot=False)
1086+ (array([[197.20868123],
1087+ [ 1.39141948]]),
1088+ array([0.]))
10851089
10861090 """
1091+
10871092 # Make a copy of the kwargs dictionary since we will modify it
10881093 kwargs = dict (kwargs )
10891094
@@ -1121,7 +1126,14 @@ def singular_values_plot(syslist, omega=None,
11211126 plt .clf ()
11221127 ax_sigma = plt .subplot (111 , label = 'control-sigma' )
11231128
1129+ # color cycle handled manually as all singular values
1130+ # of the same systems are expected to be of the same color
11241131 color_cycle = plt .rcParams ['axes.prop_cycle' ].by_key ()['color' ]
1132+ color_offset = 0
1133+ if len (ax_sigma .lines ) > 0 :
1134+ last_color = ax_sigma .lines [- 1 ].get_color ()
1135+ if last_color in color_cycle :
1136+ color_offset = color_cycle .index (last_color ) + 1
11251137
11261138 sigmas , omegas , nyquistfrqs = [], [], []
11271139 for idx_sys , sys in enumerate (syslist ):
@@ -1151,7 +1163,8 @@ def singular_values_plot(syslist, omega=None,
11511163 nyquistfrqs .append (nyquistfrq )
11521164
11531165 if plot :
1154- color = color_cycle [idx_sys % len (color_cycle )]
1166+ color = color_cycle [(idx_sys + color_offset ) % len (color_cycle )]
1167+ color = kwargs .pop ('color' , color )
11551168
11561169 nyquistfrq_plot = None
11571170 if Hz :
0 commit comments