Data Science
Data Science
Class: SY IT B
Roll no.: 5568
Name: Ronit Manoj Thakur
Class: SY IT B
Roll no.: 5568
PRACTICAL 1
1. Plot a Simple histogram and bar plot and apply various customization
techniques.
CODE:
import matplotlib.pyplot as plt
data = [1, 2, 2, 3, 3, 3, 4, 4, 4, 4]
plt.hist(data, bins=4, color='white', edgecolor='black', alpha=0.7)
plt.xlabel('Value')
plt.ylabel('Frequency')
plt.title('Simple Histogram with Customizations (IT B 5568)')
plt.grid(False)
plt.show()
OUTPUT:
Name: Ronit Manoj Thakur
Class: SY IT B
Roll no.: 5568
B. barplot:
CODE:
import matplotlib.pyplot as plt
categories = ['A', 'B', 'C', 'D']
values = [5, 7, 3, 8]
plt.bar(categories, values, color='black', edgecolor='black')
plt.xlabel('Category')
plt.ylabel('Value')
plt.title('Simple Bar Plot with Customizations (IT B 5568)')
plt.grid(axis='y')
plt.show()
OUTPUT:
Name: Ronit Manoj Thakur
Class: SY IT B
Roll no.: 5568
C. Seaborn Histogram with KDE
CODE:
import seaborn as sns
import matplotlib.pyplot as plt
data = [1, 2, 2, 3, 3, 3, 4, 4, 4, 4]
sns.histplot(data, bins=4, kde=True, color='white',alpha=0.3)
plt.xlabel('Value')
plt.ylabel('Frequency')
plt.title('Seaborn Histogram with KDE (IT B 5568)')
plt.show()
OUTPUT:
Name: Ronit Manoj Thakur
Class: SY IT B
Roll no.: 5568
D.
CODE:
import seaborn as sns
import matplotlib.pyplot as plt
categories = ['A', 'B', 'C', 'D']
values = [5, 7, 3, 8]
sns.barplot(x=categories, y=values, hue=categories, palette='Blues')
plt.xlabel('Category')
plt.ylabel('Value')
plt.title('Seaborn Bar Plot with Customizations (IT B 5568)')
plt.show()
OUTPUT:
Name: Ronit Manoj Thakur
Class: SY IT B
Roll no.: 5568