直奔主题吧。。以下是对matplotlib画图的简单讲解,代码已测试。

win7 + pycharm + python 2.7

参考文档:

http://old.sebug.net/paper/books/scipydoc/matplotlib_intro.html


捷径:查看gallery,寻找要画的图,copy代码,修改,done

http://matplotlib.org/gallery.html

# -*- coding: utf-8 -*-
import numpy as np
import matplotlib.pyplot as plt x = np.linspace(0, 10, 1000)
y = np.sin(x)
z = np.cos(x**2) # figsize:单位为英寸 dpi:指定绘图对象的分辨率,default is 80.
# 宽度现在为8*80=640
# 但是用工具栏中的保存按钮保存下来的png图像的大小是800*400像素。 plt.figure(figsize=(8,4))
# latex inserted, use it directly.
plt.plot(x,y,label="$sin(x)$",color="red",linewidth=2)
# "b--":formated string, blue and dashed line
plt.plot(x,z,"b--",label="$cos(x^2)$")
plt.xlabel("Time(s)")
plt.ylabel("Volt")
plt.title("PyPlot First Example")
plt.ylim(-2, 2)
plt.legend()
plt.show() # figure(i) means draw ith figure. If i exists, it will not create new figure object,
# but make it as current figure object plt.figure(1)
plt.plot(x,y,label="$sin(x)$",color="red",linewidth=2)
plt.show()
plt.figure(2)
plt.plot(x,z,"b--",label="$cos(x^2)$")
plt.show()

  

python-matplotlib-lec0的更多相关文章

  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. Hive进阶_汇总

    =========================================================================== 第2章 Hive数据的导入 使用Load语句执行 ...

  2. FusionCharts图表控件中文版使用手册

    三要素:swf.data.xml.承载图表的载体 1.Swf: 按照你所设计的图表类型加载相应的.swf文件到你的工程即可(eg:若你想生成一张二维柱状图,那么在你的工程里就必须包含Column2D. ...

  3. 批量插入,update

    #####setting 1create table t as select * from all_objects where 1 =2; ###.模拟逐行提交的情况,注意观察执行时间DECLAREB ...

  4. 047 Permutations II 有重复数字的全排列

    给定一个可能包含重复数字的集合,返回所有可能的不同全排列.例如,[1,1,2] 有以下不同全排列:[  [1,1,2],  [1,2,1],  [2,1,1]] 详见:https://leetcode ...

  5. CellSet 遍历

    CellSet 结构: 查询MDX: SELECT NON EMPTY {{ {{ {{ {{ {{ AddCalculatedMembers([店铺.店铺ID].[店铺ID].Members)}} ...

  6. git忽略已经被提交的文件

    git忽略已经被提交的文件 git rm --cached logs/xx.log 然后更新 .gitignore 忽略掉目标文件, 最后 git commit -m "We really ...

  7. @Primary 使用

    造轮子的一个小小的发现 当一个接口被两个service实现时,controller调用接口实现功能,会报错,提示开发者指定service,官方是建议你使用@Qualifier来区分的,但是,总有另一种 ...

  8. Php—AJAX跨域问题

    <?php /** * ajax proxy * ajax跨域解决办法 * @author  suconghou <suconghou@126.com> * @version v1. ...

  9. MiniDao分页的坑

    //TODO 此处切记不要传(page-1)*rows,MiniDAO底层已经做了此运算,.sql文件中也无需写limit,会自动加上List<BcProjectSampleBackEntity ...

  10. 转:IOS程序之间的文件共享

    原文 System-Declared Uniform Type Identifiers One of the common tasks that an iOS developer has to do ...