背景:

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. C# 基础(2)

    打开一个解决方案,以.sin后缀名,.csproj是项目文件的后缀名. Console.WriteLine("这是我的第二个项目!");你想显示的内容 Console.ReadKe ...

  2. 关于动态生成dom绑定事件失效的原因

    之前做项目都是直接用jquery的bind绑定事件,不过当时都不是动态生成dom元素,而是已经页面中原本存在的dom元素进行事件绑定,最近在测试给动态生成的dom绑定事件的时候发现事件失效,于是就测试 ...

  3. MySQL之CAST与CONVERT 函数的用法

    两者具体的语法如下:CAST(value as type); CONVERT(value, type); 可以转换的类型是有限制的.这个类型可以是以下值其中的一个: 二进制,同带binary前缀的效果 ...

  4. 【原】java环境变量配置&& jdk配置 && 各配置的意义

    本配置需要新建JAVA_HOME和classpath两个: JAVA_HOME 指明JDK安装路径.(在安装好java之后就该配置) classpath 为java加载类(class or lib)路 ...

  5. Linux下paste命令

    paste 用于将多个文件按照列队列进行合并. 该命令主要用来将多个文件的内容合并,与cut命令完成的功能刚好相反. 1.原文件: 1>a.txt [root@localhost home]# ...

  6. RaisingStudio.SessionFactory 发布 0.1版

    功能描述: 1. 支持Orchard中方便使用自定义数据库连接. 2. 连接信息可配置. 用法: 1. 构造函数中添加IRepositoryFactory引用 private readonly IRe ...

  7. Deis logo 开源PaaS系统 Deis

    Deis 是一个 Django/Celery API 服务器.Python CLI 和一组 Chef cookbooks 合并起来提供一个类似 Heroku 的应用平台,用于公有云和私有云.Deis ...

  8. 个性二维码开源专题<后背景>

    //设置图片资源 private Image img1; public override void SetParam() { base.SetParam(); //读取图片 string _image ...

  9. Topshelf入门

    简介 Topshelf允许我们快速的开发.调试和部署windows服务. 官方网站 使用方法 第一步:安装 Install-Package Topshelf Install-Package Topsh ...

  10. 使用Js脚本 修改控制IE的注册表相关设置(activex等)

    使用Js脚本 修改控制IE的注册表相关设置(activex等) 分类: PHP2012-12-05 18:51 2035人阅读 评论(2) 收藏 举报 脚本写法: <SCRIPT LANGUAG ...