iris_visualization

import pandas as pd
import warnings 
#ignore the warnings that generated by seaborn 
warnings.filterwarnings('ignore')
import seaborn as sns
%matplotlib inline 
import matplotlib.pyplot as plt

sns.set(style='white',color_codes=True)

#reas dateset
iris=pd.read_csv('Iris.csv')
iris.head()
IdSepalLengthCmSepalWidthCmPetalLengthCmPetalWidthCmSpecies
015.13.51.40.2Iris-setosa
124.93.01.40.2Iris-setosa
234.73.21.30.2Iris-setosa
344.63.11.50.2Iris-setosa
455.03.61.40.2Iris-setosa
#how many examples of each species
iris['Species'].value_counts()
Iris-setosa 50 Iris-versicolor 50 Iris-virginica 50 Name: Species, dtype: int64
iris.plot(kind='scatter',x="SepalLengthCm", y="SepalWidthCm")
<matplotlib.axes._subplots.AxesSubplot at 0x7fa78c7a7e80>

这里写图片描述

sns.jointplot(x='SepalLengthCm',y='SepalWidthCm',data=iris,size=5)
<seaborn.axisgrid.JointGrid at 0x7fa78c712eb8>

这里写图片描述

#add information fot what species each plant is
sns.FacetGrid(data=iris,hue='Species',size=5).map(plt.scatter,'SepalLengthCm','SepalWidthCm').add_legend()
<seaborn.axisgrid.FacetGrid at 0x7fa78c1f2940>

这里写图片描述

#look at individual feature in seaborn boxplot
sns.boxplot(x='Species',y='SepalLengthCm',data=iris)
<matplotlib.axes._subplots.AxesSubplot at 0x7fa78c0c52e8>

这里写图片描述

ax1=sns.boxplot(x='Species',y='SepalLengthCm',data=iris)
sns.stripplot(x='Species',y='SepalLengthCm',data=iris,jitter=True,edgecolor='gray',ax=ax1)
<matplotlib.axes._subplots.AxesSubplot at 0x7fa78bc41b38>

这里写图片描述

sns.violinplot(x='Species',y='SepalLengthCm',data=iris)
<matplotlib.axes._subplots.AxesSubplot at 0x7fa78bb57d68>

这里写图片描述

sns.FacetGrid(data=iris,hue='Species',size=6).map(sns.kdeplot,'SepalLengthCm',shade=True).add_legend()
<seaborn.axisgrid.FacetGrid at 0x7fa78c27e2b0>

这里写图片描述

iris.head()
IdSepalLengthCmSepalWidthCmPetalLengthCmPetalWidthCmSpecies
015.13.51.40.2Iris-setosa
124.93.01.40.2Iris-setosa
234.73.21.30.2Iris-setosa
344.63.11.50.2Iris-setosa
455.03.61.40.2Iris-setosa
#show the relation between each pair of attributes
sns.pairplot(iris.drop(['Id'],axis=1),hue='Species',size=3,diag_kind='kde')
<seaborn.axisgrid.PairGrid at 0x7fa78c5fab38>

这里写图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

hebastast

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值