Python for Finance: Analyze Big Financial Data

(Elle) #1
plt.plot(y, ‘ro’)
plt.grid(True)
plt.legend(loc= 0 )
plt.axis(‘tight’)
plt.xlabel(‘index’)
plt.ylabel(‘value’)
plt.title(‘A Simple Plot’)

Further location options for plt.legend include those presented in Table 5-4.


Table 5-4. Options for plt.legend


Loc Description

Empty

Automatic

0

Best possible

1

Upper right

2

Upper left

3

Lower left

4

Lower right

5

Right

6

Center left

7

Center right

8

Lower center

9

Upper center

10

Center
Free download pdf