@@ -17,55 +17,55 @@ def fig_1():
1717 figure (1 )
1818 t = arange (0 , 40.0 * pi , 0.1 )
1919 l , = plot (t , 100 * sin (t ), 'r' , label = 'sine' )
20- legend ()
20+ legend (loc = 'best' )
2121
2222def fig_2 ():
2323 figure (2 )
2424 plot (x , 'o' , label = 'x=y' )
25- legend ()
25+ legend (loc = 'best' )
2626
2727def fig_3 ():
2828 figure (3 )
2929 plot (x , - x , 'o' , label = 'x= -y' )
30- legend ()
30+ legend (loc = 'best' )
3131
3232def fig_4 ():
3333 figure (4 )
3434 plot (x , ones (len (x )), 'o' , label = 'y=1' )
3535 plot (x , - ones (len (x )), 'o' , label = 'y=-1' )
36- legend ()
36+ legend (loc = 'best' )
3737
3838def fig_5 ():
3939 figure (5 )
4040 n , bins , patches = hist (randn (1000 ), 40 , normed = 1 )
4141 l , = plot (bins , normpdf (bins , 0.0 , 1.0 ), 'r--' , label = 'fit' , linewidth = 3 )
42- legend ([l , patches [0 ]], ['fit' , 'hist' ])
42+ legend ([l , patches [0 ]], ['fit' , 'hist' ], loc = 'best' )
4343
4444def fig_6 ():
4545 figure (6 )
4646 plot (x , 50 - x , 'o' , label = 'y=1' )
4747 plot (x , x - 50 , 'o' , label = 'y=-1' )
48- legend ()
48+ legend (loc = 'best' )
4949
5050def fig_7 ():
5151 figure (7 )
5252 xx = x - (N / 2.0 )
5353 plot (xx , (xx * xx )- 1225 , 'bo' , label = '$y=x^2$' )
5454 plot (xx , 25 * xx , 'go' , label = '$y=25x$' )
5555 plot (xx , - 25 * xx , 'mo' , label = '$y=-25x$' )
56- legend ()
56+ legend (loc = 'best' )
5757
5858def fig_8 ():
5959 figure (8 )
6060 b1 = bar (x , x , color = 'm' )
6161 b2 = bar (x , x [::- 1 ], color = 'g' )
62- legend ([b1 [0 ], b2 [0 ]], ['up' , 'down' ])
62+ legend ([b1 [0 ], b2 [0 ]], ['up' , 'down' ], loc = 'best' )
6363
6464def fig_9 ():
6565 figure (9 )
6666 b1 = bar (x , - x )
6767 b2 = bar (x , - x [::- 1 ], color = 'r' )
68- legend ([b1 [0 ], b2 [0 ]], ['down' , 'up' ])
68+ legend ([b1 [0 ], b2 [0 ]], ['down' , 'up' ], loc = 'best' )
6969
7070def fig_10 ():
7171 figure (10 )
@@ -74,7 +74,8 @@ def fig_10():
7474 b3 = bar (x , - x , bottom = 100 )
7575 b4 = bar (x , - x [::- 1 ], bottom = 100 , color = 'r' )
7676 legend ([b1 [0 ], b2 [0 ], b3 [0 ], b4 [0 ]], ['bottom right' , 'bottom left' ,
77- 'top left' , 'top right' ])
77+ 'top left' , 'top right' ],
78+ loc = 'best' )
7879
7980if __name__ == '__main__' :
8081 nfigs = 10
0 commit comments