1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
| import matplotlib.pyplot as plt import seaborn as sns import pandas as pd
data = pd.read_csv("iris/iris.csv")
plt.figure(figsize=(20, 12))
plt.subplot(3, 3, 1) sns.barplot(x="Species", y="Sepal.Length", data=data) plt.title("Sepal Length by Species")
plt.subplot(3, 3, 2) data["Species"].value_counts().plot.pie(autopct="%1.1f%%") plt.title("Species Distribution") plt.ylabel("")
plt.subplot(3, 3, 3) sns.histplot(data["Sepal.Length"], kde=False) plt.title("Sepal Length Histogram")
plt.subplot(3, 3, 4) sns.kdeplot(data["Sepal.Length"], shade=True) plt.title("Sepal Length KDE")
plt.subplot(3, 3, 5) sns.boxplot(x="Species", y="Sepal.Length", data=data) plt.title("Sepal Length Boxplot by Species")
plt.subplot(3, 3, 6) sns.scatterplot(x="Sepal.Length", y="Sepal.Width", hue="Species", data=data) plt.title("Sepal Length vs Sepal Width")
plt.subplot(3, 3, 7) sns.lineplot(x="Petal.Length", y="Petal.Width", hue="Species", data=data) plt.title("Petal Length vs Petal Width")
plt.tight_layout() plt.show()
|