背景:

1)数据可视化

目前还处于python入门阶段,主要想通过numpy、matplotlib进行数据可视化。

安装:

操作系统:windows7

1)python2.7 安装numpy、matplotlib

pip安装numpy没有问题

pip通过tar安装matplotlib不成功,提示缺少freetype、png,反正挺麻烦的。

2)python3.5安装numpy、matplotlib

pip直接搞定,安装matplotlib的时候会安装关联的模块。

安装numpy和matplotlib后,pip list展示安装了哪些模块。

使用:

网上随便找了个例子,如下:

import numpy as np
import matplotlib.pyplot as plt N = 5
menMeans = (20, 35, 30, 35, 27)
menStd = (2, 3, 4, 1, 2) ind = np.arange(N) # the x locations for the groups
width = 0.35 # the width of the bars fig, ax = plt.subplots()
rects1 = ax.bar(ind, menMeans, width, color='r', yerr=menStd) womenMeans = (25, 32, 34, 20, 25)
womenStd = (3, 5, 2, 3, 3)
rects2 = ax.bar(ind+width, womenMeans, width, color='y', yerr=womenStd) # add some
ax.set_ylabel('Scores')
ax.set_title('Scores by group and gender')
ax.set_xticks(ind+width)
ax.set_xticklabels( ('G1', 'G2', 'G3', 'G4', 'G5') ) ax.legend( (rects1[0], rects2[0]), ('Men', 'Women') ) def autolabel(rects):
# attach some text labels
for rect in rects:
height = rect.get_height()
ax.text(rect.get_x()+rect.get_width()/2., 1.05*height, '%d'%int(height),
ha='center', va='bottom') autolabel(rects1)
autolabel(rects2) plt.show()

  

运行图:

----------------------------------------------------

python matplotlib的更多相关文章

  1. python matplotlib 中文显示参数设置

    python matplotlib 中文显示参数设置 方法一:每次编写代码时进行参数设置 #coding:utf-8import matplotlib.pyplot as pltplt.rcParam ...

  2. python matplotlib plot 数据中的中文无法正常显示的解决办法

    转发自:http://blog.csdn.net/laoyaotask/article/details/22117745?utm_source=tuicool python matplotlib pl ...

  3. python matplotlib画图产生的Type 3 fonts字体没有嵌入问题

    ScholarOne's 对python matplotlib画图产生的Type 3 fonts字体不兼容,更改措施: 在程序中添加如下语句 import matplotlib matplotlib. ...

  4. 使用Python matplotlib做动态曲线

    今天看到“Python实时监控CPU使用率”的教程: https://www.w3cschool.cn/python3/python3-ja3d2z2g.html 自己也学习如何使用Python ma ...

  5. python matplotlib 中文显示乱码设置

    python matplotlib 中文显示乱码设置 原因:是matplotlib库中没有中文字体.1 解决方案:1.进入C:\Anaconda64\Lib\site-packages\matplot ...

  6. Python - matplotlib 数据可视化

    在许多实际问题中,经常要对给出的数据进行可视化,便于观察. 今天专门针对Python中的数据可视化模块--matplotlib这块内容系统的整理,方便查找使用. 本文来自于对<利用python进 ...

  7. 转:使用 python Matplotlib 库 绘图 及 相关问题

     使用 python Matplotlib 库绘图      转:http://blog.csdn.net/daniel_ustc/article/details/9714163 Matplotlib ...

  8. python+matplotlib 绘制等高线

    python+matplotlib 绘制等高线 步骤有七: 有一个m*n维的矩阵(data),其元素的值代表高度 构造两个向量:x(1*n)和y(1*m).这两个向量用来构造网格坐标矩阵(网格坐标矩阵 ...

  9. 安装python Matplotlib 库

    转:使用 python Matplotlib 库 绘图 及 相关问题  使用 python Matplotlib 库绘图      转:http://blog.csdn.net/daniel_ustc ...

  10. python matplotlib.pyplot 散点图详解(1)

    python matplotlib.pyplot散点图详解(1) 一.创建散点图 可以用scatter函数创建散点图 并使用show函数显示散点图 代码如下: import matplotlib.py ...

随机推荐

  1. window 2003 配置FTP +防火墙设置

    2保险的做法是 不允许匿名登录,吧钩去掉 后面我们会添加一个用户,并且赋予权限 3 主目录 可以设置时当前计算机目录或者是另一台计算机目录(映射) FTP站点目录:浏览定位FTP文件所在站点,给予是否 ...

  2. 真正意义上的spring环境中的单元测试方案spring-test与mokito完美结合

    真正意义上的spring环境中的单元测试方案spring-test与mokito完美结合 博客分类: java 测试 单元测试SpringCC++C#  一.要解决的问题:     spring环境中 ...

  3. three.js 之旅 (五)--跟场景scene相关的函数

    1.scene.add(obj);   在场景中添加物体 2.scene.remove(obj);   在场景中移除物体 3.scene.children();  获取场景中所有子对象的列表 4.sc ...

  4. expect工具的简单用法

    原创文档,转载请注明作者与本文URL. linux中的expect工具很不错,能够自动实现交互,也即是说自己自动进行ssh登录等动作.这是我写的一个简单的用法,稍作修改就可以变成很实用都脚本.有人介绍 ...

  5. css定位的简单总结

    关于css的定位,相信初接触css的同学都头疼不已.相对定位.绝对定位连名字都这么像,用起来更是一会被遮住一会被挤出去,踩了很多坑之后,对css的定位进行一个简单的总结,以免重蹈覆辙. 其实掌握好几种 ...

  6. [ACM] poj 1064 Cable master (二分查找)

    Cable master Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 21071   Accepted: 4542 Des ...

  7. Poj-1157-LITTLE SHOP OF FLOWERS

    题意为从每行取一瓶花,每瓶花都有自己的审美价值 第 i+1 行取的花位于第 i 行的右下方 求最大审美价值 dp[i][j]:取到第 i 行,第 j 列时所获得的最大审美价值 动态转移方程:dp[i] ...

  8. delphi 处理图片(剪切,压缩)

    剪切bmp:效果为指定的rect大小,若图片比rect小,则会放大. 都要uses Vcl.Imaging.jpeg; 需要注意的是FMX里也需要jpeg的支持,虽然没引用编译器不会报错,但用到jpg ...

  9. 解决:Could not load type 'System.ServiceModel.Activation.HttpModule' from assemb

    解决:Could not load type 'System.ServiceModel.Activation.HttpModule' from assembly 'System.ServiceMode ...

  10. SQL语句汇总(一)——数据库与表的操作以及创建约束

    首先,非常感谢大家对上篇博文的支持,真是让本菜受宠若惊,同时对拖了这么久才出了此篇表示抱歉. 前言:此文旨在汇总从建立数据库到联接查询等绝大部分SQL语句.SQL语句虽不能说很多,但稍有时间不写就容易 ...