python3绘图示例1(基于matplotlib)
#!/usr/bin/env python
# -*- coding:utf-8 -*- import numpy as np
import matplotlib.pyplot as plt
import json
from decimal import Decimal # 保留浮点类型
jstring='{"name":"pro","price":12.05}'
str=json.loads(jstring,parse_float=Decimal)
print(str) # 柱状图
def is_outlier(points,threshold=3.5):
if len(points.shape)==1:
points=points[:,None] median=np.median(points,axis=0)
diff=np.sum((points-median)**2,axis=-1)
diff=np.sqrt(diff)
med_abs_deviation=np.median(diff) modified_z_score=0.6745*diff/med_abs_deviation
return modified_z_score > threshold x=np.random.random(10)
buckets=50
np.r_[x,-49,95,100,-100]
fitered=x[~is_outlier(x)] plt.figure() plt.subplot(211)
plt.hist(x,buckets)
plt.xlabel('Raw') plt.subplot(212)
plt.hist(fitered,buckets)
plt.xlabel('Cleaned') plt.show()
python3绘图示例1(基于matplotlib)的更多相关文章
- python3绘图示例6-2(基于matplotlib,绘图流程介绍及设置等)
#!/usr/bin/env python# -*- coding:utf-8 -*- import os import numpy as npimport matplotlib as mpltfro ...
- python3绘图示例6-1(基于matplotlib,绘图流程介绍及设置等)
#!/usr/bin/env python# -*- coding:utf-8 -*- import os import pylab as pyimport numpy as npfrom matpl ...
- 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绘图示例2(基于matplotlib:柱状图、分布图、三角图等)
#!/usr/bin/env python# -*- coding:utf-8 -*- from matplotlib import pyplot as pltimport numpy as npim ...
- python3绘图示例3(基于matplotlib:折线图等)
#!/usr/bin/env python# -*- coding:utf-8 -*-from pylab import *from numpy import *import numpy # 数据点图 ...
- Matplotlib常用绘图示例
一.Matplotlib介绍 Matplotlib是一个Python的2D绘图库,它以各种硬拷贝格式和跨平台的交互式环境生成出版质量级别的图形.通过Matplotlib,开发者可以仅需要几行代码,便可 ...
- 基于matplotlib的数据可视化 -
matplotlib.pyplot(as mp or as plt)提供基于python语言的绘图函数 引用方式: import matplotlib.pyplot as mp / as plt 本章 ...
- 在绘图的时候import matplotlib.pyplot as plt报错:ImportError: No module named '_tkinter', please install the python-tk package
在绘图的时候import matplotlib.pyplot as plt报错:ImportError: No module named '_tkinter', please install the ...
随机推荐
- Eclipse使用Ctrl+C和Ctrl+V复制粘贴时总是卡顿
Eclipse使用Ctrl+C和Ctrl+V复制粘贴时总是卡顿,解决办法: 更改打开代码超链接按键Ctrl为Alt: Window -> Preferences -> General -& ...
- 树莓派使用 HLS 实现视频流直播
说明 这次介绍一下基于上一篇文章"树莓派编译安装 FFmpeg "的应用,即 HLS 视频流直播.原理是 FFmpeg 将 USB 摄像头的原始视频流压缩为 H.264 视频流,然 ...
- Request库基本使用
基本实例 import requests url= 'https://www.baidu.com/' response = requests.get(url) print(type(response) ...
- Educational Codeforces Round 13 C
Description Little Joty has got a task to do. She has a line of n tiles indexed from 1 to n. She has ...
- jconsole如何查看
https://www.jdon.com/idea/jvm-gc.html 场景: https://www.cnblogs.com/yszzu/p/9648579.html 查看大对象到底占用多 ...
- log4j2重复打印日志问题解决
log4j2.xml <?xml version="1.0" encoding="UTF-8"?> <Configuration> &l ...
- hutool http+天气预报
中国天气接口:http://www.weather.com.cn/data/sk/地址.html,只显示当天. sojson接口:http://t.weather.sojson.com/api/wea ...
- 12-----BBS论坛
BBS论坛(十二) 12.1.图形验证码生成 (1)utils/captcha/init.py import random import string # Image:一个画布 # ImageDraw ...
- 转 Python-IndexError: list index out of range
https://www.cnblogs.com/2bjiujiu/p/9063864.html Error:IndexError: list index out of range Where? 对Py ...
- 转——jdbcType与javaType的对应关系
------------------------------------------------ 原文:https://blog.csdn.net/haofeng82/article/details/ ...