@@ -680,6 +680,39 @@ def test_display_margins(nsys, display_margins, gridkw, match):
680680 assert cplt .axes [0 , 0 ].get_title () == ''
681681
682682
683+ def test_singular_values_plot_colors ():
684+ # Define some systems for testing
685+ sys1 = ct .rss (4 , 2 , 2 , strictly_proper = True )
686+ sys2 = ct .rss (4 , 2 , 2 , strictly_proper = True )
687+
688+ # Get the default color cycle
689+ color_cycle = plt .rcParams ['axes.prop_cycle' ].by_key ()['color' ]
690+
691+ # Plot the systems individually and make sure line colors are OK
692+ cplt = ct .singular_values_plot (sys1 )
693+ assert cplt .lines .size == 1
694+ assert len (cplt .lines [0 ]) == 2
695+ assert cplt .lines [0 ][0 ].get_color () == color_cycle [0 ]
696+ assert cplt .lines [0 ][1 ].get_color () == color_cycle [0 ]
697+
698+ cplt = ct .singular_values_plot (sys2 )
699+ assert cplt .lines .size == 1
700+ assert len (cplt .lines [0 ]) == 2
701+ assert cplt .lines [0 ][0 ].get_color () == color_cycle [1 ]
702+ assert cplt .lines [0 ][1 ].get_color () == color_cycle [1 ]
703+ plt .close ('all' )
704+
705+ # Plot the systems as a list and make sure colors are OK
706+ cplt = ct .singular_values_plot ([sys1 , sys2 ])
707+ assert cplt .lines .size == 2
708+ assert len (cplt .lines [0 ]) == 2
709+ assert len (cplt .lines [1 ]) == 2
710+ assert cplt .lines [0 ][0 ].get_color () == color_cycle [0 ]
711+ assert cplt .lines [0 ][1 ].get_color () == color_cycle [0 ]
712+ assert cplt .lines [1 ][0 ].get_color () == color_cycle [1 ]
713+ assert cplt .lines [1 ][1 ].get_color () == color_cycle [1 ]
714+
715+
683716if __name__ == "__main__" :
684717 #
685718 # Interactive mode: generate plots for manual viewing
0 commit comments