可视化-鸢尾花

R语言:

需要使用包:绘图包ggplot2、gridExtra(图形分布)、GGally(ggplot扩展,适合做成对出现图形)

library(ggplot2)

library(gridExtra)

#加载数据

iris=read.csv('../input/Iris.csv')

View(iris)

可视化-鸢尾花_第1张图片

ggplot(data=iris, aes(x=Sepal.Length, y=Sepal.Width, colour=Species, shape=Species)) + geom_point()

可视化-鸢尾花_第2张图片

ggplot(iris, aes(Species, Petal.Length, fill=Species)) + geom_boxplot()


可视化-鸢尾花_第3张图片

HisSl <- ggplot(data=iris, aes(x=Sepal.Length))+

geom_histogram(binwidth=0.2, color="black", aes(fill=Species)) +

theme(legend.position="none")+

ggtitle("Histogram of Sepal Length")


HistSw <- ggplot(data=iris, aes(x=Sepal.Width)) +

geom_histogram(binwidth=0.2, color="black", aes(fill=Species)) +

theme(legend.position="none")+

ggtitle("Histogram of Sepal Width")


HistPl <- ggplot(data=iris, aes(x=Petal.Length))+

geom_histogram(binwidth=0.2, color="black", aes(fill=Species)) +

theme(legend.position="none")+

ggtitle("Histogram of Petal Length")


HistPw <- ggplot(data=iris, aes(x=Petal.Width))+

geom_histogram(binwidth=0.2, color="black", aes(fill=Species)) +

theme(legend.position="bottom" )+

ggtitle("Histogram of Petal Width")


grid.arrange(HisSl,HistSw,HistPl,HistPw,nrow = 2,top = textGrob("Iris Frequency Histogram",gp=gpar(fontsize=15)))


可视化-鸢尾花_第4张图片

ggpairs(data = iris[1:4],title = "Iris Correlation Plot")

可视化-鸢尾花_第5张图片

python:

三个依赖库:pandas(pandas 是基于 Numpy 构建的含有更高级数据结构和工具的数据分析包)、seaborn(Seaborn是在matplotlib的基础上进行了更高级的API封装,从而使得作图更加容易)、matplotlib(python一个强大的绘图库)

import pandas as pd

import warnings

import seaborn as sns

import matplotlib.pyplot as plt

#读入数据

iris=pd.read_csv("../input/Iris.csv")

iris.head()

iris["Species"].value_counts()

iris.plot(kind="scatter",x="SepalLengthCm",y="SepalWidthCm")

plt.show()

可视化-鸢尾花_第6张图片

sns.jointplot(x="SepalLengthCm",y="SepalWidthCm",data=iris,size=5)


可视化-鸢尾花_第7张图片

sns.FacetGrid(iris, hue="Species", size=5) \    .map(plt.scatter, "SepalLengthCm", "SepalWidthCm") \    .add_legend()


可视化-鸢尾花_第8张图片

ax=sns.stripplot(x="Species",y="PetalLengthCm",data=iris,jitter=True,edgecolor="gray")


可视化-鸢尾花_第9张图片

sns.pairplot(iris.drop("Id", axis=1), hue="Species", size=3)


可视化-鸢尾花_第10张图片

knime:

通过csv reader读入iris文件。然后在analytics下的statistics下选择对应的可视化展现

可视化-鸢尾花_第11张图片

SPSS statistics:

导入数据

你可能感兴趣的:(可视化-鸢尾花)