Matplotlib直方图和四方图
来源:互联网 发布:真实恐怖故事知乎 编辑:程序博客网 时间:2024/06/01 10:47
import pandas as pdimport matplotlib.pyplot as pltreviews = pd.read_csv("D:\\test\\fandango_scores.csv")clos = ["Fandango_Ratingvalue","RT_norm","IMDB_norm","RT_norm_round","Metacritic_norm_round"]reviews_num = reviews[clos]
dis_imdb = reviews_num["Fandango_Ratingvalue"].value_counts() #对值进行统计dis_index = dis_imdb.sort_index() #按索引排序print(dis_imdb) print(dis_index)
4.1 163.9 124.2 124.3 113.4 94.5 93.5 93.7 93.6 84.0 74.4 73.2 52.9 53.8 53.3 43.0 44.6 43.1 34.8 32.8 22.7 2Name: Fandango_Ratingvalue, dtype: int642.7 22.8 22.9 53.0 43.1 33.2 53.3 43.4 93.5 93.6 83.7 93.8 53.9 124.0 74.1 164.2 124.3 114.4 74.5 94.6 44.8 3Name: Fandango_Ratingvalue, dtype: int64
fig,ax = plt.subplots()#ax.hist(reviews_num["Fandango_Ratingvalue"]) #直方图#ax.hist(reviews_num["Fandango_Ratingvalue"],bins=20) #指定的划分区间有多少个#ax.hist(reviews_num["Fandango_Ratingvalue"],range=(0,3)) #只统计x轴上0到3的ax.hist(reviews_num["Fandango_Ratingvalue"],bins=20,range=(4,5)) #将4到5之间划分成20个区间plt.show()
fig = plt.figure(figsize=(5,20))ax1= fig.add_subplot(4,1,1)ax2= fig.add_subplot(4,1,2)ax1.hist(reviews_num["Fandango_Ratingvalue"],bins=20,range=(0,5))ax1.set_title("Distribution Rating")ax1.set_ylim(0,50) #设置y轴区间ax2.hist(reviews_num["RT_norm"],bins=20,range=(0,5))ax2.set_title("Distribution Rating")ax2.set_ylim(0,50)plt.show()
fig,ax = plt.subplots()ax.boxplot(reviews_num["RT_norm"])ax.set_xticklabels(["RT_norm"])ax.set_ylim(0,5)plt.show()
fig,ax = plt.subplots()ax.boxplot(reviews_num[clos].values)ax.set_xticklabels(clos,rotation=90)ax.set_ylim(0,5)plt.show()
0 0
- Matplotlib直方图和四方图
- matplotlib(直方图,条形图,饼图,散点图)基础知识
- python数据分析——matplotlib生成折线图,散点图和直方图
- 使用matplotlib画栈式直方图
- Python进阶(三十八)-数据可视化の利用matplotlib 进行折线图,直方图和饼图的绘制
- matplotlib入门教程--1(条形图, 直方图, 盒须图, 饼图)
- matplotlib与pyecharts:折线图、箱线图、散点图、直方图
- matplotlib画直方图(1)
- matplotlib画直方图(2)
- python matplotlib之 hist直方图
- OpenGL: 折线图和直方图
- Python数据可视化:Matplotlib 直方图、箱线图、条形图、热图、折线图、散点图。。。
- python数据可视化(matplotlib,pandas绘图,直方图,散点图,柱状图,折线图,箱线图)
- 【Python-matplotlib】画直方图(hist)
- python matplotlib 画直方图报错
- Python-Matplotlib(4) 直方图与四分图
- 使用matplotlib画散点图/连线图/直方图
- 八、matplotlib系列---pyplot直方图的绘制
- 【Python】Python 3.x 中"HTTP Error 403: Forbidden"问题的解决方案
- 【gulp】JS文件的压缩混淆与雪碧图
- HDU1540Tunnel Warfare(线段树区间合并)
- 排序算法之快速排序
- uboot下init_sequence_f函数之setup_reloc
- Matplotlib直方图和四方图
- poj1716Integer Intervals
- 线程常用的方法
- jQuery Mobile页面加载机制及页面跳转出现的问题
- Spring 查找hibernate映射文件:mappingResources、mappingLocations、mappingDirectoryLocations与mappingJarLocatio
- 游戏开发完整学习路线
- thinkphp表单令牌防止重复提交
- 函数的默认实参
- 使用RecyclerView展示瀑布流的效果