Professional Documents
Culture Documents
DT 2nd Worksheet
DT 2nd Worksheet
DT 2nd Worksheet
Experiment: 2
plt.plot(y)
plt.show()
plt.plot(y,X)
plt.title("Graph")
plt.xlabel("X Axis")
plt.ylabel ("Y Axis")
University Institute of Engineering
Department of Computer Science & Engineering
plt.show()
University Institute of Engineering
Department of Computer Science & Engineering
2. Bar plot:
2.1]Plot a bar chart:
x = [30,20,20,10,20]
y = ["CSGO","VALORANT","PUBG","DESTINY 2","C.O.D"]
plt.show()
plt.xlabel('Days')
plt.ylabel('Distance (kms)')
plt.title('Information')
plt.legend()
plt.show()
University Institute of Engineering
Department of Computer Science & Engineering
plt.show()
University Institute of Engineering
Department of Computer Science & Engineering
3) Scatter plot:
3.1) Scatter plot:
x = [5, 2, 9, 4, 7] # x-axis values
y = [10, 5, 8, 4, 2] # Y-axis values
plt.xlabel('Salary * 1000')
plt.ylabel('<Age>')
plt.title('Age Vs Salary')
plt.xlabel('Saving*100')
plt.ylabel('Income*1000')
plt.title('Scatter Plot')
plt.legend()
plt.grid()
plt.show()
University Institute of Engineering
Department of Computer Science & Engineering
4. Pie plot
COUNTRIES = 'INDIA','AMERICA','CHINA','RUSSIA','UNITED KINGDOM'
BILLIONAIRES = [30, 200, 140, 50, 30]
plt.show()
University Institute of Engineering
Department of Computer Science & Engineering
Example 2
continents = 'ASIA','AFRICA','ANTARTICA','EUROPE'
area = [ '31033131','29648481','13720000','22134900']
# Plot
plt.pie(area, explode=explode, labels=continents, colors=colors, shadow = True ,
autopct='%1.1f%%' )
plt.title('\POPULATION IN DIFFERENT CONTINENTS/')
plt.show()
University Institute of Engineering
Department of Computer Science & Engineering
2)BAR PLOT:
University Institute of Engineering
Department of Computer Science & Engineering
3)SCATTER PLOT:
University Institute of Engineering
Department of Computer Science & Engineering
4)PIE PLOT:
University Institute of Engineering
Department of Computer Science & Engineering
1. use of ‘matplotlib’