Matplotlib是一个Python 2D绘图库,可以跨平台生成各种硬拷贝格式和交互式环境的出版品质量图。

http://matplotlib.org/  matplotlib官网

http://python.jobbole.com/85106/  matplotlib 绘图可视化知识点整理

http://www.cnblogs.com/xubing-613/p/5895948.html  IPython绘图和可视化---matplotlib 入门

http://blog.csdn.net/qq_26376175/article/details/67637151  python中matplotlib的颜色及线条控制(就是关于折线的颜色)

https://morvanzhou.github.io/tutorials/  莫烦PYTHON的youtube教程  (youtube: https://www.youtube.com/watch?v=dLrndCJzbzA&index=1 )

http://www.yiibai.com/numpy/numpy_matplotlib.html#article-start  字符和标记的对照

http://www.cnblogs.com/qq21270/p/8271607.html  我的一个小例子(读取文本,生成折线图)  2018-1-12


一个简单的坐标图:散点图、折线图

  1. import matplotlib
  2. import matplotlib.pyplot as plt
  3.  
  4. # matplotlib.use('qt4agg')
  5. matplotlib.rcParams['font.sans-serif'] = ['SimHei']# 为了能显示中文(而不是显示一个框)
  6. matplotlib.rcParams['font.family']='sans-serif'
  7. matplotlib.rcParams['axes.unicode_minus'] = False # 为了能显示负号(而不是显示一个框)
  8.  
  9. def scatterPlots():
  10. plt.title('标题') # 设置图表标题
  11. plt.title('标题1111',color='#ff33a0')
  12. plt.xlabel('x 轴') # 设置X坐标轴标题
  13. plt.ylabel('y 轴') # 设置Y坐标轴表
  14. plt.xlim(0, 7) # 设置坐标轴的范围(设置坐标轴取值范围
  15. plt.ylim(0, 100)
  16. # plt.xticks([2,4])#设置x轴的标签间隔
  17. # plt.yticks([4,16])#设置y轴的标签间隔
  18.  
  19. # r:red, b:blue, g:green, y:yellow, k:black, w:white, c:cyan蓝绿色, m:magenta品红
  20. # o:圆点, *:五角星, s:方块, p:五边形, h:六边形, H:六边形, 还有:+ x D d(菱形)<>v^|
  21. x = [1, 2, 3, 4, 5, 6, 7]
  22. y = [91, 98, 97, 49, 49, 50, 50]
  23. plt.plot(x, y, '*r')
  24. y = [68.38, 64.30, 74.99, 36.80, 33.23, 40.98, 32.70]
  25. plt.plot(x, y, 'oy')
  26. y = [17, 10, 20, 0, 2, 8, 0]
  27. plt.plot(x, y, 'og')
  28. y = [82, 69, 91, 39, 43, 46, 40]
  29. plt.plot(x, y, 'm') # 不写 o*sphx+Dd 等参数,是折线图
  30. plt.show()
  31. scatterPlots()

figure

  1. import matplotlib.pyplot as plt
  2. import numpy as np
  3.  
  4. x = np.linspace(0, 10, 50)
  5. y1 = 2 * x+1
  6. y2 = x ** 2
  7.  
  8. plt.figure()
  9. plt.plot(x, y1)
  10.  
  11. plt.figure(num=3, figsize=(10, 10))
  12. plt.plot(x, y2)
  13. plt.plot(x, y1, color="#ff9900", linewidth=2,linestyle="--") # 颜色,线宽,虚线
  14.  
  15. plt.show()

字符 描述

  1. '-' 实线样式
  2. '--' 短横线样式
  3. '-.' 点划线样式
  4. ':' 虚线样式
  5. '.' 点标记
  6. ',' 像素标记
  7. 'o' 圆标记
  8. 'v' 倒三角标记
  9. '^' 正三角标记
  10. '&lt;' 左三角标记
  11. '&gt;' 右三角标记
  12. '1' 下箭头标记
  13. '2' 上箭头标记
  14. '3' 左箭头标记
  15. '4' 右箭头标记
  16. 's' 正方形标记
  17. 'p' 五边形标记
  18. '*' 星形标记
  19. 'h' 六边形标记 1
  20. 'H' 六边形标记 2
  21. '+' 加号标记
  22. 'x' X 标记
  23. 'D' 菱形标记
  24. 'd' 窄菱形标记
  25. '|' 竖直线标记
  26. '_' 水平线标记

颜色:

  1. 'b' 蓝色
  2. 'g' 绿色
  3. 'r' 红色
  4. 'c' 青色
  5. 'm' 品红色
  6. 'y' 黄色
  7. 'k' 黑色
  8. 'w' 白色

...

py库: matplotlib的更多相关文章

  1. tablib把数据导出为Excel、JSON、CSV等格式的Py库(写入数据并导出exl)

    #tablib把数据导出为Excel.JSON.CSV等格式的Py库 #python 3 import tablib #定义列标题 headers = ('1列', '2列', '3列', '4列', ...

  2. Python可视化库Matplotlib的使用

    一.导入数据 import pandas as pd unrate = pd.read_csv('unrate.csv') unrate['DATE'] = pd.to_datetime(unrate ...

  3. py库: arrow (时间)

    arrow是个时间日期库,简洁易用.支持python3.6 https://arrow.readthedocs.io/en/latest/ arrow官网api https://github.com/ ...

  4. py库: scrapy (深坑未填)

    scrapy 一个快速高级的屏幕爬取及网页采集框架 http://scrapy.org/ 官网 https://docs.scrapy.org/en/latest/ Scrapy1.4文档 http: ...

  5. py库: Tesseract-OCR(图像文字识别)

    http://blog.csdn.net/u012566751/article/details/54094692 Tesseract-OCR入门使用1 http://blog.csdn.net/u01 ...

  6. py库: django (web框架)

    http://www.imooc.com/learn/736 Python-走进Requests库 http://www.imooc.com/learn/790 django入门与实践 http:// ...

  7. py库: jieba (中文词频统计) 、collections (字频统计)、WordCloud (词云)

    先来个最简单的: # 查找列表中出现次数最多的值 ls = [1, 2, 3, 4, 5, 6, 1, 2, 1, 2, 1, 1] ls = ["呵呵", "呵呵&qu ...

  8. Python第三方库matplotlib(2D绘图库)入门与进阶

    Matplotlib 一 简介: 二 相关文档: 三 入门与进阶案例 1- 简单图形绘制 2- figure的简单使用 3- 设置坐标轴 4- 设置legend图例 5- 添加注解和绘制点以及在图形上 ...

  9. Python数据可视化库-Matplotlib(二)

    我们接着上次的继续讲解,先讲一个概念,叫子图的概念. 我们先看一下这段代码 import matplotlib.pyplot as plt fig = plt.figure() ax1 = fig.a ...

随机推荐

  1. css样式问题解决

    1.关于滚动条 (1)布局后由于写了 overflow-y: scroll; 在内容还没有超出就出现了滚动条. 我的解决方法是直接去掉了滚动条: .class::-webkit-scrollbar { ...

  2. guava-retrying 源码解析(导入项目)

    1.从github上下载guava-retry源码 git clone git://github.com/rholder/guava-retrying.git 2.导入idea,使用gradle记得勾 ...

  3. HTML5:定位

    定位 一.介绍: position设置块级元素相对于其父块的位置和相对于它自身应该在的位置,任何使用定位的元素都会成为块级元素. 1.属性值 属性值 描述 absolute 生成绝对定位的元素,相对于 ...

  4. leetcode题解 200. Number of Islands(其实就是一个深搜)

    题目: Given a 2d grid map of '1's (land) and '0's (water), count the number of islands. An island is s ...

  5. 数据文件resize回收空间

    场景说明: 客户 ASM磁盘组,data磁盘组空闲空间90G,空间不足,因此强烈建议回收空间 空间回收方案: 1.数据文件resize,回收部分可用性空间(好处就是能够将ASM磁盘组free大小增加) ...

  6. DG_数据文件转换参数测试

    本篇博客流程图: 一.测试需求及参数说明 二.测试环境进行相关测试 三.问题总结 一.测试需求及参数说明 1.1测试需求说明 DG切换 切换前,数据库版本12.2.0.1,主库rac两节点,备一rac ...

  7. XXS level7

    (1)输入与第六关相同的Payload:"><A HREF="javascript:alert()"> 查看页面源代码,发现“herf"被过滤 ...

  8. PTA寒假一

    7-1 打印沙漏 (20 分) 本题要求你写个程序把给定的符号打印成沙漏的形状.例如给定17个"*",要求按下列格式打印 所谓"沙漏形状",是指每行输出奇数个符 ...

  9. 《Netty in action》 读书笔记

    声明:这篇文章是记录读书过程中的知识点,并加以归纳总结,成文.文中图片.代码出自<Netty in action>. 1. 为什么用Netty? 每个框架的流行,都一定有它出众的地方.Ne ...

  10. enumerate()使用

    enumerate()使用 如果对一个列表,既要遍历索引又要遍历元素时,首先可以这样写: list1 = ["这", "是", "一个", ...