Professional Documents
Culture Documents
Data Visulization Notes
Data Visulization Notes
• line
• marker
• color
• linestyle
• linewidth
• markersize
# Bar Graph
std = [9,10,11,12]
strength = [50,55,45,60]
plt.bar(std,strength,color='m')
plt.savefig('E:/12C2022/graph1.jpg')
plt.xticks(std,color='g')
plt.yticks([0,20,40,60])
plt.grid()
plt.show()
# using CSV (comma separated value) file
import pandas as pd
df = pd.DataFrame(pd.read_csv('marks.csv'))
'''
0 Amit 67 76 88
1 Sumit 80 65 76
2 Jeet 78 60 90
'''
df.plot(kind='bar',x='Name')
df.plot()
OR
df.plot(kind=’line’)
Ans:
w11 = [78, 47, 59, 66, 47, 72, 80, 50, 41, 67, 60, 61, 68, 52,
47, 61, 79, 65, 69, 44, 52, 42, 56, 40, 63, 67, 41, 60,
42, 60, 77, 54, 58, 56, 59, 73, 48, 71, 68, 67, 74, 44,
70, 49, 79, 52, 52, 67, 75, 43, 60, 75, 55, 41, 54, 74,
62, 80, 71, 76]
w12 = [77, 76, 78, 74, 63, 66, 54, 76, 56, 53, 44, 75, 59, 71,
50, 77, 45, 40, 72, 62, 44, 71, 41, 63, 47, 44, 78, 43,
58, 60, 45, 40, 67, 76, 46, 45, 69, 53, 66, 49, 58, 46,
66, 65, 74, 55, 72, 71, 66, 75, 41, 74, 74, 57, 54, 52,
79, 65, 42, 76]
plt.hist([w11,w12],bins=[40,50,60,70,80])
plt.xlabel('Weight (in Kg)')
plt.ylabel('No. of Students')
plt.show()