Lab 9
Lab 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.] ]
Ensure to have the following specifications on the chart
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
1
PROGRAM
import numpy as np
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='b',linewidth=2,linestyle='--',label='LINE-III')
plt.legend(loc=2)
plt.show()
2
OUTPUT
3
b) Write a program to plot a line chart to depict a comparison of population in millions
between India and Pakistan from 1960 to 2010.
4
OUTPUT