box-and-whisker plot —— Python Data Science Cookook
来源:互联网 发布:多功能拍照软件 编辑:程序博客网 时间:2024/05/14 07:51
Sources from : Python Data Science Cookbook case
A box-and-whisker plot is a good companion with the summary statistics to view the statistical summary of the data in hand. Box-and-whiskers can effectively represent quantiles in data and also outliers, if any, emphasizing the overall structure of the data. A box plot consists of the following features:
- A horizontal line indicating the median that indicates the location of the data
- A box spanning the interquartile range, measuring the dispersion
- A set of whiskers that extends from the central box horizontally and vertically, which indicates the tail of the distribution
箱形图:最大优点展示数据的结构和异常点
- 标出中位线
- 箱形扩展到4分位(箱子下沿是数据分布在25%的标识,箱子中间那条线50%,箱子上沿75%)
- 箱子以外的垂直于箱子的线是头尾两端的数据分布
iris是sklearn库自带的数据集, 详询https://archive.ics.uci.edu/ml/datasets/Iris
#!/usr/bin/env python2# -*- coding: utf-8 -*-"""Created 2017@author: snaildove"""# Load Librariesimport numpy as npfrom sklearn.datasets import load_irisimport matplotlib.pyplot as plt# Load Iris datasetdata = load_iris()x = data['data']plt.close('all')#Let’s demonstrate how to create a box-and-whisker plot:# Plot the box and whiskerfig = plt.figure(1)ax = fig.add_subplot(111)ax.boxplot(x)ax.set_xticklabels(data['feature_names'])plt.show()y=data['target']class_labels = data['target_names']fig = plt.figure(2,figsize=(18,10))sub_plt_count = 221for t in range(0,3): ax = fig.add_subplot(sub_plt_count) y_index = np.where(y==t)[0] x_ = x[y_index,:] ax.boxplot(x_) ax.set_title(class_labels[t]) ax.set_xticklabels(data['feature_names']) sub_plt_count+=1plt.show()
0 0
- box-and-whisker plot —— Python Data Science Cookook
- PCA(Principal Component Analysis) —— Python Data Science Cookook
- 箱线图(box & whisker plot)—数据准备
- Performing summary statistics and plots —— Python Data Science Cookbook
- Stemming the words and word lemmatization —— Python Data Science CookBook
- data imputation —— Python Data Science Cookbook
- sampling brief —— python data science cookbook
- Removing stop words —— Python Data Science CookBook
- Data Science in Python
- Python for data science
- Using scatter plots for multivariate data —— python data science cookbook
- class Python Data Science Toolbox
- How draw a stem -and -leaf & box-plot display by R.or Python
- the bag of words representation —— Python Data Science CookBook
- Box Plot
- class Intermediate Python for Data Science
- Data Science完整学习路径Python版
- Graduate Programs in Big Data Analytics and Data Science
- 清浮动常见方法总结
- 如何实现多样式富文本?
- 股票买卖(dp之路)
- 蓝桥杯-第七届省赛javaC组- 平方怪圈
- Python更新hosts
- box-and-whisker plot —— Python Data Science Cookook
- 第一篇文章
- CUDA二维纹理内存+OpenCV图像滤波
- 配置linux syslog服务器+配置syslog客户端
- PorterDuff.Mode及Xfermode详解
- 【c++】通过示例详细说明类的声明
- 指纹识别
- 网海茫茫,有你最暖
- 表达式求值