PGM - 9
PGM - 9
PYPLOT-I
a) Create multiple line charts on common plot where three data ranges are plotted on
same chart. The data ranges to be plotted are
Data = [[5., 25., 45., 20.,15. ], [ 8., 13., 29., 27.,18. ], [ 9., 29., 27., 39.,22.] ]
i) Line should be red in color with width of 3 and dashed dotted line style ii)
Line should be green in color with width of 4 and dashed dotted style iii)
Line should be black in color with width of 2 and dashed line style iv) The
legends should be LINE-I, LINE-II and LINE-III and it should be placed in the
upper left corner
v) X Axis label should be X VALUES [0,1,2,3,4] vi) Y Axis label
should be Y VALUES [DATA VALUES] vii) Title of your
chart should be MULTI RANGE LINE CHART PROGRAM
matplotlib.pyplot as plt
Data = [[5., 25., 45., 20.,15. ], [ 8., 13., 29., 27.,18. ], [ 9., 29., 27., 39.,22.] ]
X=np.arange(5) plt.plot(X,Data[0],
color='r',linewidth=3,linestyle='-.',label='LINE-I') plt.plot(X,Data[1],
color='g',linewidth=4,linestyle=':',label='LINE-II') plt.plot(X,Data[2],
color='k',linewidth=2,linestyle='--',label='LINE-III') plt.legend(loc=2)
plt.show()
30
OUTPUT
31
YEAR 1960 1970 1980 1990 2000 2010
32
OUTPUT
33