美文网首页
可视化-鸢尾花

可视化-鸢尾花

作者: potherb | 来源:发表于2017-03-19 18:42 被阅读0次

R语言:

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

library(ggplot2)

library(gridExtra)

#加载数据

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

View(iris)

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

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

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)))

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


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()

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

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

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

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

knime:

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

SPSS statistics:

导入数据

相关文章

  • 代码

    # 利用鸢尾花数据集,实现前向传播、反向传播,可视化loss曲线 # 导入所需模块 import tensorfl...

  • 可视化-鸢尾花

    R语言: 需要使用包:绘图包ggplot2、gridExtra(图形分布)、GGally(ggplot扩展,适合做...

  • Iris鸢尾花数据集可视化、线性回归、决策树分析、KMeans聚

    数据集可视化 采用Python的Sklearn机器学习库中自带的数据集——鸢尾花数据集。简单分析数据集之间特征的关...

  • 机器学习算法:回归(理论)

    1. 鸢尾花 demo 检查数据最好的方法是将其可视化,将所有数据放到一张图表中,制作散点图(scatter pl...

  • 鸢尾花数据集可视化

    众所周知数据挖掘的主要任务有如下两点: 预测任务:即根据已知属性来预测未知属性,根据已知数据来推断未知事物 描叙任...

  • 实用 | 分享一个决策树可视化工具

    一、具体代码和步骤 可视化我们的决策树模型的第一步是把模型训练出来。下面这个例子是在鸢尾花数据上,采用随机森林的方...

  • 每日一花

    鸢尾花

  • 鸢尾花(8)

    上一篇连载链接: 长篇原创连载小说《鸢尾花》(1) 长篇原创连载小说《鸢尾花》(2) 长篇原创连载小说《鸢尾花》(...

  • 机器学习函数库——Scikit-learn

    Scikit-learn的数据集 基本的自带数据集: 以鸢尾花数据集为例,鸢尾花数据集采集的是鸢尾花的测量数据及其...

  • 鸢尾花

    紫色鸢尾花

网友评论

      本文标题:可视化-鸢尾花

      本文链接:https://www.haomeiwen.com/subject/nxkvnttx.html