python3绘图示例3(基于matplotlib:折线图等)
#!/usr/bin/env python
# -*- coding:utf-8 -*-
from pylab import *
from numpy import *
import numpy # 数据点图-数据点平滑处理
def moveing_average(ineterval,window_size):
window=ones(int(window_size))/float(window_size)
return convolve(ineterval,window,'same') t=linspace(-4,4,100)
y=sign(t)+randn(len(t))*0.1
plot(t,y,'k.') y_av=moveing_average(y,10)
plot(t,y_av,'r') xlabel('time')
ylabel('value')
grid(True)
show() # 图2-一个为曲线图 一个为折线图
windows=['flat','hanning','hamming','bartlett','blackman'] def smooth(x,window_len=11,window='hanning'):
if x.ndim!=1:
print('ere') if x.size<window_len:
print('ee2') if window_len<3:
return x if not window in windows:
print('4') s=numpy.r_[x[window_len-1:0:-1],x,x[-1:-window_len:-1]] if window=='flat':
w=numpy.ones(window_len,'d')
else:
w=eval('numpy.'+window+'(window_len)')
y=numpy.convolve(w/w.sum(),s,mode='valid')
return y t=linspace(-4,4,100)
x=sign(t)
xn=x+randn(len(t))*0.1 y=smooth(x) ws=31
subplot(211)
plot(ones(ws)) for w in windows[1:]:
eval('plot('+w+'(ws))')
axis([0,30,0,1.1])
legend(windows)
title('smoothing') subplot(212)
plot(x)
plot(xn)
for w in windows[1:]:
plot(smooth(xn,10,w))
I=['original ','noise']
I.extend(windows)
legend(I) title('signal')
show()
python3绘图示例3(基于matplotlib:折线图等)的更多相关文章
- matplotlib常见绘图基础代码小结:折线图、散点图、条形图、直方图、饼图
一.折线图 二.散点图 三.条形图 四.直方图 五.饼图 一.折线图折线图用于显示随时间或有序类别的变化趋势 from matplotlib import pyplot as plt x = rang ...
- 使用matplotlib绘图(一)之折线图
# 使用matplotlib绘制折线图 import matplotlib.pyplot as plt import numpy as np # 在一个图形中创建两条线 fig = plt.figur ...
- python matplotlib 折线图
1.绘制折线图,去上和右边框,显示中文 import numpy as np import matplotlib.pyplot as plt #plt.style.use('default') #pl ...
- matplotlib 折线图
1.基本要点 # 导入模块 from matplotlib import pyplot as plt # x轴数据 x = range(2, 26, 2) # y轴数据 y = [15, 13, 14 ...
- 练习: bs4 简单爬取 + matplotlib 折线图显示 (关键词,职位数量、起薪)
要看一种技术在本地的流行程度,最简单的就是找招聘网站按关键词搜索. 比如今天查到的职位数量是vue 1296个,react 1204个,angular 721个.国际上比较流行的是react,本地市场 ...
- matplotlib折线图
绘制折线图:参考https://baijiahao.baidu.com/s?id=1608586625622704613 (3)近10年GDP变化的曲线图,及三次产业GDP变化的曲 ...
- python3绘图示例5(基于matplotlib:正弦图等)
#!/usr/bin/env python# -*- coding:utf-8 -*- import numpy as npimport pylab as pyimport matplotlib as ...
- python3绘图示例4(基于matplotlib:箱线图、散点图等)
#!/usr/bin/env python# -*- coding:utf-8 -*- from matplotlib.pyplot import * x=[1,2,3,4]y=[5,4,3,2] # ...
- python3绘图示例6-2(基于matplotlib,绘图流程介绍及设置等)
#!/usr/bin/env python# -*- coding:utf-8 -*- import os import numpy as npimport matplotlib as mpltfro ...
随机推荐
- 图片滚动插件jquery bxslider
https://www.cnblogs.com/axl234/p/4167196.html
- POJ-1128-Frame Stacking
链接:https://vjudge.net/problem/POJ-1128 题意: 每张图片上面画了一些边框,给出这些边框叠在一起后的图片,图片边框一定是由一个字母表示并且每条边至少三个字符,输入保 ...
- Linux中apache服务
httpd访问控制生成共享文件vim var/www/html/cq/index.html编辑配置文件 vim /etc/httpd/conf/httpd.conf<Directory &quo ...
- Juniper SRX550防火墙web页面CPU达到100%的故障解决办法
Juniper SRX550防火墙web页面CPU达到100%的故障解决办法 利用telnet远程连接主机,对web页面注销重新登录即可,在配置中输入命令:run restart web-manage ...
- thinkphp自动验证和自动完成
tp验证码的自动验证小案例 模板文件 <form action="" method="post"> <p> User: <inpu ...
- linux下重启php服务
有时候修改了一些php配置或者进程满了需要重启php [root@snoopy :: bin]# service php-fpm restart Gracefully shutting down ph ...
- Android NDK开发 JNI类型签名和方法签名(六)
在Java存在两种数据类型: 基本类型 和 引用类型 ,大家都懂的 . 在JNI的世界里也存在类似的数据类型,与Java比较起来,其范围更具严格性,如下: 1.primitive types ---- ...
- 表单注册及自定义validate手机验证码验证实例
<!DOCTYPE html> <html lang="zh-CN"> <head> <meta charset="utf-8& ...
- Codecraft-18 and Codeforces Round #458 (Div. 1 + Div. 2, combined) F. Substrings in a String
http://codeforces.com/contest/914/problem/F 以前做过一个类似的,但是查询的子串长度最多是10,这个时候就是用bit + hash做了.这是因为改变一个字符, ...
- Unity 为什么有时候播放音乐(音效)会没有声音
1.问题描述 昨晚,我遇到的情况如下: 1.MainCamera里有Audio Source,并且在循环播放音乐 2.在其他的GameObject中也新增一个Audio Source,在某个时机播放音 ...