Seaborn: Key Features
Seaborn: Key Features
Seaborn is a powerful and user-friendly Python library built on top of Matplotlib. It simplifies the
process of creating attractive and informative statistical graphics, making it an excellent choice for
data visualization.
Key Features:
Types:
Univariate Plots
1. Histogram
Example:
import numpy as np
data = np.random.randn(1000)
# Create a histogram
plt.xlabel("Value")
plt.ylabel("Frequency")
plt.show()
Example:
plt.xlabel("Value")
plt.ylabel("Density")
plt.show()
3. Box Plot
Example:
sns.boxplot(x=data, color="cyan")
plt.xlabel("Value")
plt.show()
4. Violin Plot
Example:
sns.violinplot(x=data, color="purple")
plt.xlabel("Value")
plt.show()
Bivariate Plots
1. Scatter Plot
Visualizes the relationship between two continuous variables.
Example:
x = np.random.rand(100)
y = np.random.rand(100)
plt.xlabel("X-axis")
plt.ylabel("Y-axis")
plt.show()
2. Line Plot
Example:
y = np.sin(x)
plt.xlabel("X-axis")
plt.ylabel("Y-axis")
plt.show()
3. Heatmap
Example:
4. Bar Plot
Example:
plt.xlabel("Categories")
plt.ylabel("Values")
plt.show()
Example:
import pandas as pd
data = pd.DataFrame({
"X": np.random.rand(50),
"Y": np.random.rand(50),
"Z": np.random.rand(50)
})
sns.pairplot(data)
plt.show()