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 ...
随机推荐
- net core 认证及简单集群
net core 认证及简单集群 在Asp.net WebAPI中,认证是通过AuthenticationFilter过滤器实现的,我们通常的做法是自定义AuthenticationFilter,实现 ...
- missfresh问题记录
一.基本信息 1.登陆机器 ssh lina02@mjump.missfresh.net -p2222 二.问题 1.分页问题:job_id为空时能查询出来(笛卡尔乘积),需要加上AND res ...
- HDU 2243 考研路茫茫——单词情结 求长度小于等于L的通路总数的方法
http://acm.hdu.edu.cn/showproblem.php?pid=2243 这是一题AC自动机 + 矩阵快速幂的题目, 首先知道总答案应该是26^1 + 26^2 + 26^3 .. ...
- feign容断忽略某些异常
@HystrixCommand(ignoreExceptions={ BusinessException.class, IllegalArgumentException.class, BadCrede ...
- 邮箱/邮件地址的正则表达式及分析(JavaScript,email,regex)
简言 在做用户注册时,常会用到邮箱/邮件地址的正则表达式.本文列举了几种方案,大家可以根据自己的项目情况,选择最适合的方案. 方案1 (常用) 规则定义如下: 以大写字母[A-Z].小写字母[a-z] ...
- php 判断字符串中是否包含另一个字符串 strpos
strpos (PHP 4, PHP 5, PHP 7) strpos — 查找字符串首次出现的位置 说明 strpos ( string $haystack , $needle [, int $o ...
- zblog去除底部版权信息 “请勿修改或删除主题版权及作者信息”
场景:使用了免费模板,但底部带作者版权.删除版权信息的代码后访问前台弹窗:请勿修改或删除主题版权及作者信息... 1. 删除版权信息代码 使用notepad++搜索功能,搜索版权信息:如ABC,找到相 ...
- JFinal免费公开课更新中
价值千元的课程,免费报名学习,JFinal学院-小木 录制JFinal视频教程,JFinal核心已经周边涉及到微信小程序开发.数据库.前端实战等.
- ubuntu下irobot串口通讯
在window下以前就`有一个现成的串口代码.想移植到ubuntu下,发现都不一样了.要重新找个. 折腾了一上午之后,发现自己写这个串口通讯还是有一点难度. 于是,用了github上 Erick Co ...
- Cordova for iOS
Cordova,对这个名字大家可能比较陌生,大家肯定听过 PhoneGap 这个名字,Cordova 就是 PhoneGap 被 Adobe 收购后所改的名字. Cordova 是一个可以让 JS 与 ...