python显示包函数的简单介绍( 三 )


normed: 是否将得到的直方图向量归一化 。默认为0
facecolor: 直方图颜色
edgecolor: 直方图边框颜色
alpha: 透明度
histtype: 直方图类型,‘bar’, ‘barstacked’, ‘step’, ‘stepfilled’
返回值 :
n: 直方图向量 , 是否归一化由参数normed设定
bins: 返回各个bin的区间范围
patches: 返回每个bin里面包含的数据 , 是一个list
from skimage import data
import matplotlib.pyplot as plt
img=data.camera()
plt.figure("hist")
arr=img.flatten()
n, bins, patches = plt.hist(arr, bins=256, normed=1,edgecolor='None',facecolor='red')
plt.show()
例:
mu, sigma = 0, .1
s = np.random.normal(loc=mu, scale=sigma, size=1000)
a,b,c = plt.hist(s, bins=3)
print("a: ",a)
print("b: ",b)
print("c: ",c)
plt.show()
结果:
a:[ 85. 720. 195.]#每个柱子的值
b:[-0.36109509 -0.13573180.089631490.31499478]#每个柱的区间范围
c:a list of 3 Patch objects#总共多少柱子
8、ax1.scatter(x,y,c = 'r',marker = 'o')
使用注意:确定python显示包函数了figure就一定要确定象限,然后用scatter,或者不确定象限,直接使用plt.scatter
x = np.arange(1,10)
y = x
fig = plt.figure()
a=plt.subplot()#默认为一个象限
# a=fig.add_subplot(222)
a.scatter(x,y,c='r',marker='o')
plt.show()
结果
x = np.arange(1,10)
y = x
plt.scatter(x,y,c='r',marker='o')
plt.show()
结果
import numpy as np
import matplotlib.pyplot as plt
x = np.arange(1,10)
y = x
plt.figure()
plt.scatter(x,y,c='r',marker='o')
plt.show()
结果
文章知识点与官方知识档案匹配
Python入门技能树基础语法函数
211242 人正在系统学习中
打开CSDN APP , 看更多技术内容
plt的一些函数的使用_班花i的博客_plt函数
plt.函数 Fwuyi的博客 6513 1plt.figure( )函数:创建画布 2plt.plot(x, y, format_string, label="图例名"):绘制点和线, 并控制样式 。其中x是x轴数据,y是y轴数据,xy一般是列表和数组 。format_string 是字符串的格式包括线...
继续访问
Python的数据科学函数包(三)——matplotlib(plt)_hxxjxw的博客...
import matplotlib.pyplot as plt plt.imshow(img) plt.show() plt.imshow()有一个cmap参数,即指定颜色映射规则 。默认的cmap即颜料板是十色环 哪怕是单通道图,值在0-1之间,用plt.imshow()仍然可以显示彩色图,就是因为颜色映射的关...
继续访问
对Python中plt的画图函数详解
今天小编就为大家分享一篇对Python中plt的画图函数详解,具有很好的参考价值,希望对大家有所帮助 。一起跟随小编过来看看吧
plt.plot()函数详解
plt.plot()函数详细介绍 plt.plot(x, y, format_string, **kwargs) 参数 说明 x X轴数据,列表或数组 , 可选 y Y轴数据,列表或数组 format_string 控制曲线的格式字符串,可选 **kwargs 第二组或更多(x,y,format_string),可画多条曲线 format_string 由颜色字符、风格字符、标记字符组成 颜色字符 'b' 蓝色 'm' 洋红色 magenta 'g' 绿色 'y.
继续访问
python图像处理基础知识(plt库函数说明)_小草莓爸爸的博客_p...
1.画图(plt库)1.1 plt.figure(num=’’,figsize=(x, y),dpi= ,facecolor=’’,edgecolor=’’)num:表示整个图标的标题 figsize:表示尺寸 facecolor:表示1.2 plt.plot(x,y,format_string,**kwargs)...
继续访问
plt的一些函数使用_neo3301的博客_plt函数
1、plt.plot(x,y) plt.plot(x,y,format_string,**kwargs) x轴数据,y轴数据,format_string控制曲线的格式字串 format_string 由颜色字符,风格字符,和标记字符 import matplotlib.pyplot as plt ...

推荐阅读