2121import matplotlib .pyplot as plt
2222from matplotlib import transforms
2323
24- def rainbow_text (x ,y , ls , lc , ** kw ):
24+ def rainbow_text (x , y , strings , colors , ** kw ):
2525 """
26- Take a list of strings ``ls `` and colors ``lc `` and place them next to each
27- other, with text ls [i] being shown in color lc [i].
26+ Take a list of ``strings `` and colors ``colors `` and place them next to each
27+ other, with text strings [i] being shown in colors [i].
2828
2929 This example shows how to do both vertical and horizontal text, and will
3030 pass all keyword arguments to plt.text, so you can set the font size,
@@ -34,14 +34,14 @@ def rainbow_text(x,y,ls,lc,**kw):
3434 fig = plt .gcf ()
3535
3636 #horizontal version
37- for s ,c in zip (ls , lc ):
37+ for s ,c in zip (strings , colors ):
3838 text = plt .text (x , y , " " + s + " " , color = c , transform = t , ** kw )
3939 text .draw (fig .canvas .get_renderer ())
4040 ex = text .get_window_extent ()
4141 t = transforms .offset_copy (text ._transform , x = ex .width , units = 'dots' )
4242
4343 #vertical version
44- for s ,c in zip (ls , lc ):
44+ for s ,c in zip (strings , colors ):
4545 text = plt .text (x , y , " " + s + " " , color = c , transform = t ,
4646 rotation = 90 , va = 'bottom' , ha = 'center' , ** kw )
4747 text .draw (fig .canvas .get_renderer ())
0 commit comments