python-matplotlib-lec0
直奔主题吧。。以下是对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的更多相关文章
- python matplotlib 中文显示参数设置
python matplotlib 中文显示参数设置 方法一:每次编写代码时进行参数设置 #coding:utf-8import matplotlib.pyplot as pltplt.rcParam ...
- python matplotlib plot 数据中的中文无法正常显示的解决办法
转发自:http://blog.csdn.net/laoyaotask/article/details/22117745?utm_source=tuicool python matplotlib pl ...
- python matplotlib画图产生的Type 3 fonts字体没有嵌入问题
ScholarOne's 对python matplotlib画图产生的Type 3 fonts字体不兼容,更改措施: 在程序中添加如下语句 import matplotlib matplotlib. ...
- 使用Python matplotlib做动态曲线
今天看到“Python实时监控CPU使用率”的教程: https://www.w3cschool.cn/python3/python3-ja3d2z2g.html 自己也学习如何使用Python ma ...
- python matplotlib 中文显示乱码设置
python matplotlib 中文显示乱码设置 原因:是matplotlib库中没有中文字体.1 解决方案:1.进入C:\Anaconda64\Lib\site-packages\matplot ...
- Python - matplotlib 数据可视化
在许多实际问题中,经常要对给出的数据进行可视化,便于观察. 今天专门针对Python中的数据可视化模块--matplotlib这块内容系统的整理,方便查找使用. 本文来自于对<利用python进 ...
- 转:使用 python Matplotlib 库 绘图 及 相关问题
使用 python Matplotlib 库绘图 转:http://blog.csdn.net/daniel_ustc/article/details/9714163 Matplotlib ...
- python+matplotlib 绘制等高线
python+matplotlib 绘制等高线 步骤有七: 有一个m*n维的矩阵(data),其元素的值代表高度 构造两个向量:x(1*n)和y(1*m).这两个向量用来构造网格坐标矩阵(网格坐标矩阵 ...
- 安装python Matplotlib 库
转:使用 python Matplotlib 库 绘图 及 相关问题 使用 python Matplotlib 库绘图 转:http://blog.csdn.net/daniel_ustc ...
- python matplotlib.pyplot 散点图详解(1)
python matplotlib.pyplot散点图详解(1) 一.创建散点图 可以用scatter函数创建散点图 并使用show函数显示散点图 代码如下: import matplotlib.py ...
随机推荐
- jQuery背景插件backstretch使用指南
http://www.bkjia.com/Javascript/987917.html
- PartTime_一些网站
1. http://www.sxsoft.com/ 貌似 搜搜"破解",无符合条件的结果 http://www.taskcity.com/ "智城",貌似 符合 ...
- C#入门笔记3 表达式及运算符2
关系运算符,也称布尔比较运算符 注:var1为bool类型,var2与var3可以是其它类型.[数据类型看下一节] 运算符 类别 示例表达式 结果说明 == 二元 var1=var2==var3 如果 ...
- ABAP接口用法
1.定义接口INTERFACE intf [PUBLIC]. [components] ENDINTERFACE. 2.注意点: 2.1.接口中所定义的所有东西默认都是公共的,所以不用也不能写PU ...
- String 对象详解
原文地址:http://zangweiren.javaeye.com/blog/209895 作者:臧圩人(zangweiren) 网址:http://zangweiren.javaeye.com & ...
- 学习Linux的好网站
http://www.linuxcommand.org/ 很不错的学习shell和script的教程.包含:Learning the shell 和 writing shell scripts 两个内 ...
- 【Python图像特征的音乐序列生成】数据集制作的一些tricks
关于数据集的制作,我决定去掉很多不必要的东西,比如和弦,于是我选择了melody部分的旋律. 有了midi文件,我现在要abc序列,所以我要通过midi2abc转换一下文件. 批处理程序效果如下: 文 ...
- method 'redisConnectionFactory' threw exception; nested exception is java.lang.NoClassDefFoundError
spring boot 整合redis是报了如下错误 org.springframework.beans.factory.UnsatisfiedDependencyException: Error c ...
- Codeforces Round #321 (Div. 2) E Kefa and Watch (线段树维护Hash)
E. Kefa and Watch time limit per test 1 second memory limit per test 256 megabytes input standard in ...
- mangoDB笔记
1. 查询 db.表.find().pretty() find(querry,project) pretty()格式化显示 findOne() 返回一条结果 比较 db.Decl_In.find( ...