3.1 Matplotlib简介及图表窗口

Matplotlib → 一个python版的matlab绘图接口,以2D为主,支持python、numpy、pandas基本数据结构,运营高效且有较丰富的图表库

import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
# 图表窗口1 → plt.show()plt.plot(np.random.rand(10))
plt.show()
# 直接生成图表

# 图表窗口2 → 魔法函数,嵌入图表% matplotlib inline
x = np.random.randn(1000)
y = np.random.randn(1000)
plt.scatter(x,y)
# 直接嵌入图表,不用plt.show()
# <matplotlib.collections.PathCollection at ...> 代表该图表对象
<matplotlib.collections.PathCollection at 0x7fadfe6ec748>

# 图表窗口3 → 魔法函数,弹出可交互的matplotlib窗口% matplotlib notebook
s = pd.Series(np.random.randn(100))
s.plot(style = 'k--o',figsize=(10,5))
# 可交互的matplotlib窗口,不用plt.show()
# 可做一定调整
<IPython.core.display.Javascript object>

<matplotlib.axes._subplots.AxesSubplot at 0x7fadfda55a58>
# 图表窗口4 → 魔法函数,弹出matplotlib控制台% matplotlib qt5
df = pd.DataFrame(np.random.rand(50,2),columns=['A','B'])
df.hist(figsize=(12,5),color='g',alpha=0.8)
# 可交互性控制台
# 如果已经设置了显示方式(比如notebook),需要重启然后再运行魔法函数
# 网页嵌入的交互性窗口 和 控制台,只能显示一个#plt.close()
# 关闭窗口#plt.gcf().clear()
# 每次清空图表内内容
Warning: Cannot change to a different GUI toolkit: qt5. Using notebook instead.<IPython.core.display.Javascript object>

array([[<matplotlib.axes._subplots.AxesSubplot object at 0x7fadfdb09080>,<matplotlib.axes._subplots.AxesSubplot object at 0x7fadfdaf3898>]],dtype=object)

3.2 图表的基本元素

图表内基本参数设置

# 图名,图例,轴标签,轴边界,轴刻度,轴刻度标签等df = pd.DataFrame(np.random.rand(10,2),columns=['A','B'])
fig = df.plot(figsize=(6,4))
# figsize:创建图表窗口,设置窗口大小
# 创建图表对象,并赋值与figplt.title('Interesting Graph - Check it out')  # 图名
plt.xlabel('Plot Number')  # x轴标签
plt.ylabel('Important var') # y轴标签plt.legend(loc = 'upper right')
# 显示图例,loc表示位置
# 'best'         : 0, (only implemented for axes legends)(自适应方式)
# 'upper right'  : 1,
# 'upper left'   : 2,
# 'lower left'   : 3,
# 'lower right'  : 4,
# 'right'        : 5,
# 'center left'  : 6,
# 'center right' : 7,
# 'lower center' : 8,
# 'upper center' : 9,
# 'center'       : 10,plt.xlim([0,12])  # x轴边界
plt.ylim([0,1.5])  # y轴边界
plt.xticks(range(10))  # 设置x刻度
plt.yticks([0,0.2,0.4,0.6,0.8,1.0,1.2])  # 设置y刻度
fig.set_xticklabels("%.1f" %i for i in range(10))  # x轴刻度标签
fig.set_yticklabels("%.2f" %i for i in [0,0.2,0.4,0.6,0.8,1.0,1.2])  # y轴刻度标签
# 范围只限定图表的长度,刻度则是决定显示的标尺 → 这里x轴范围是0-12,但刻度只是0-9,刻度标签使得其显示1位小数
# 轴标签则是显示刻度的标签print(fig,type(fig))
# 查看表格本身的显示方式,以及类别
<IPython.core.display.Javascript object>

AxesSubplot(0.125,0.125;0.775x0.755) <class 'matplotlib.axes._subplots.AxesSubplot'>
# 其他元素可视性x = np.linspace(-np.pi,np.pi,256,endpoint = True)
c, s = np.cos(x), np.sin(x)
plt.plot(x, c)
plt.plot(x, s)
# 通过ndarry创建图表plt.grid(True, linestyle = "--",color = "gray", linewidth = "0.5",axis = 'x')
# 显示网格
# linestyle:线型
# color:颜色
# linewidth:宽度
# axis:x,y,both,显示x/y/两者的格网plt.tick_params(bottom='on',top='off',left='on',right='off')
# 刻度显示import matplotlib
matplotlib.rcParams['xtick.direction'] = 'out'
matplotlib.rcParams['ytick.direction'] = 'inout'
# 设置刻度的方向,in,out,inout
# 这里需要导入matploltib,而不仅仅导入matplotlib.pyplotframe = plt.gca()
#plt.axis('off')
# 关闭坐标轴
#frame.axes.get_xaxis().set_visible(False)
#frame.axes.get_yaxis().set_visible(False)
# x/y 轴不可见

3.3 图表的样式参数

linestyle、style、color、marker

# linestyle参数plt.plot([i**2 for i in range(100)],linestyle = '-.')
# '-'       solid line style
# '--'      dashed line style
# '-.'      dash-dot line style
# ':'       dotted line style
[<matplotlib.lines.Line2D at 0x7fadfe3f8b00>]
# marker参数s = pd.Series(np.random.randn(100).cumsum())
s.plot(linestyle = '--',marker = '.')
# '.'       point marker
# ','       pixel marker
# 'o'       circle marker
# 'v'       triangle_down marker
# '^'       triangle_up marker
# '<'       triangle_left marker
# '>'       triangle_right marker
# '1'       tri_down marker
# '2'       tri_up marker
# '3'       tri_left marker
# '4'       tri_right marker
# 's'       square marker
# 'p'       pentagon marker
# '*'       star marker
# 'h'       hexagon1 marker
# 'H'       hexagon2 marker
# '+'       plus marker
# 'x'       x marker
# 'D'       diamond marker
# 'd'       thin_diamond marker
# '|'       vline marker
# '_'       hline marker
<matplotlib.axes._subplots.AxesSubplot at 0x7fadfe38fba8>
# color参数plt.hist(np.random.randn(100),color = 'g',alpha = 0.8)
# alpha:0-1,透明度
# 常用颜色简写:red-r, green-g, black-k, blue-b, yellow-ydf = pd.DataFrame(np.random.randn(1000, 4),columns=list('ABCD'))
df = df.cumsum()
df.plot(style = '--.',alpha = 0.8,colormap = 'GnBu')
# colormap:颜色板,包括:
# Accent, Accent_r, Blues, Blues_r, BrBG, BrBG_r, BuGn, BuGn_r, BuPu, BuPu_r, CMRmap, CMRmap_r, Dark2, Dark2_r, GnBu, GnBu_r, Greens, Greens_r,
# Greys, Greys_r, OrRd, OrRd_r, Oranges, Oranges_r, PRGn, PRGn_r, Paired, Paired_r, Pastel1, Pastel1_r, Pastel2, Pastel2_r, PiYG, PiYG_r,
# PuBu, PuBuGn, PuBuGn_r, PuBu_r, PuOr, PuOr_r, PuRd, PuRd_r, Purples, Purples_r, RdBu, RdBu_r, RdGy, RdGy_r, RdPu, RdPu_r, RdYlBu, RdYlBu_r,
# RdYlGn, RdYlGn_r, Reds, Reds_r, Set1, Set1_r, Set2, Set2_r, Set3, Set3_r, Spectral, Spectral_r, Wistia, Wistia_r, YlGn, YlGnBu, YlGnBu_r,
# YlGn_r, YlOrBr, YlOrBr_r, YlOrRd, YlOrRd_r, afmhot, afmhot_r, autumn, autumn_r, binary, binary_r, bone, bone_r, brg, brg_r, bwr, bwr_r,
# cool, cool_r, coolwarm, coolwarm_r, copper, copper_r, cubehelix, cubehelix_r, flag, flag_r, gist_earth, gist_earth_r, gist_gray, gist_gray_r,
# gist_heat, gist_heat_r, gist_ncar, gist_ncar_r, gist_rainbow, gist_rainbow_r, gist_stern, gist_stern_r, gist_yarg, gist_yarg_r, gnuplot,
# gnuplot2, gnuplot2_r, gnuplot_r, gray, gray_r, hot, hot_r, hsv, hsv_r, inferno, inferno_r, jet, jet_r, magma, magma_r, nipy_spectral,
# nipy_spectral_r, ocean, ocean_r, pink, pink_r, plasma, plasma_r, prism, prism_r, rainbow, rainbow_r, seismic, seismic_r, spectral,
# spectral_r ,spring, spring_r, summer, summer_r, terrain, terrain_r, viridis, viridis_r, winter, winter_r# 其他参数见“颜色参数.docx”
<IPython.core.display.Javascript object>

<matplotlib.axes._subplots.AxesSubplot at 0x7fadfe373c88>
# style参数,可以包含linestyle,marker,colorts = pd.Series(np.random.randn(1000).cumsum(), index=pd.date_range('1/1/2000', periods=1000))
ts.plot(style = '--g.',grid = True)
# style → 风格字符串,这里包括了linestyle(-),marker(.),color(g)
# plot()内也有grid参数
<matplotlib.axes._subplots.AxesSubplot at 0x7f3601e96400>

# 整体风格样式import matplotlib.style as psl
print(plt.style.available)
# 查看样式列表
psl.use('ggplot')
ts = pd.Series(np.random.randn(1000).cumsum(), index=pd.date_range('1/1/2000', periods=1000))
ts.plot(style = '--g.',grid = True,figsize=(10,6))
# 一旦选用样式后,所有图表都会有样式,重启后才能关掉

课程3.4 刻度、注解、图表输出

主刻度、次刻度

# 刻度from matplotlib.ticker import MultipleLocator, FormatStrFormattert = np.arange(0.0, 100.0, 1)
s = np.sin(0.1*np.pi*t)*np.exp(-t*0.01)
ax = plt.subplot(111) #注意:一般都在ax中设置,不再plot中设置
plt.plot(t,s,'--*')
plt.grid(True, linestyle = "--",color = "gray", linewidth = "0.5",axis = 'both')
# 网格
#plt.legend()  # 图例xmajorLocator = MultipleLocator(10) # 将x主刻度标签设置为10的倍数
xmajorFormatter = FormatStrFormatter('%.0f') # 设置x轴标签文本的格式
xminorLocator   = MultipleLocator(5) # 将x轴次刻度标签设置为5的倍数
ymajorLocator = MultipleLocator(0.5) # 将y轴主刻度标签设置为0.5的倍数
ymajorFormatter = FormatStrFormatter('%.1f') # 设置y轴标签文本的格式
yminorLocator   = MultipleLocator(0.1) # 将此y轴次刻度标签设置为0.1的倍数  ax.xaxis.set_major_locator(xmajorLocator)  # 设置x轴主刻度
ax.xaxis.set_major_formatter(xmajorFormatter)  # 设置x轴标签文本格式
ax.xaxis.set_minor_locator(xminorLocator)  # 设置x轴次刻度ax.yaxis.set_major_locator(ymajorLocator)  # 设置y轴主刻度
ax.yaxis.set_major_formatter(ymajorFormatter)  # 设置y轴标签文本格式
ax.yaxis.set_minor_locator(yminorLocator)  # 设置y轴次刻度ax.xaxis.grid(True, which='both') #x坐标轴的网格使用主刻度
ax.yaxis.grid(True, which='minor') #y坐标轴的网格使用次刻度
# which:格网显示#删除坐标轴的刻度显示
#ax.yaxis.set_major_locator(plt.NullLocator())
#ax.xaxis.set_major_formatter(plt.NullFormatter())

# 注解df = pd.DataFrame(np.random.randn(10,2))
df.plot(style = '--o')
plt.text(5,0.5,'hahaha',fontsize=10)
# 注解 → 横坐标,纵坐标,注解字符串
<IPython.core.display.Javascript object>

Text(5,0.5,'hahaha')
# 图表输出df = pd.DataFrame(np.random.randn(1000, 4), columns=list('ABCD'))
df = df.cumsum()
df.plot(style = '--.',alpha = 0.5)
plt.legend(loc = 'upper left')
plt.savefig('R\pic.pdf',dpi=400,bbox_inches = 'tight',facecolor = 'g',edgecolor = 'b')
# 可支持png,pdf,svg,ps,eps…等,以后缀名来指定
# dpi是分辨率
# bbox_inches:图表需要保存的部分。如果设置为‘tight’,则尝试剪除图表周围的空白部分。
# facecolor,edgecolor: 图像的背景色,默认为‘w’(白色)
<matplotlib.legend.Legend at 0x7f3600f94fd0>

课程3.5 子图

在matplotlib中,整个图像为一个Figure对象
在Figure对象中可以包含一个或者多个Axes对象
每个Axes(ax)对象都是一个拥有自己坐标系统的绘图区域

plt.figure, plt.subplot

# plt.figure() 绘图对象
# plt.figure(num=None, figsize=None, dpi=None, facecolor=None, edgecolor=None,
# frameon=True, FigureClass=<class 'matplotlib.figure.Figure'>, **kwargs)fig1 = plt.figure(num=1,figsize=(4,2))
plt.plot(np.random.rand(50).cumsum(),'k--')
fig2 = plt.figure(num=2,figsize=(4,2))
plt.plot(50-np.random.rand(50).cumsum(),'k--')
# num:图表序号,可以试试不写或都为同一个数字的情况,图表如何显示
# figsize:图表大小# 当我们调用plot时,如果设置plt.figure(),则会自动调用figure()生成一个figure, 严格的讲,是生成subplots(111)
[<matplotlib.lines.Line2D at 0x7fadfbfc87b8>]
# 子图创建1 - 先建立子图然后填充图表fig = plt.figure(figsize=(10,6),facecolor = 'gray')ax1 = fig.add_subplot(2,2,1)  # 第一行的左图
plt.plot(np.random.rand(50).cumsum(),'k--')
plt.plot(np.random.randn(50).cumsum(),'b--')
# 先创建图表figure,然后生成子图,(2,2,1)代表创建2*2的矩阵表格,然后选择第一个,顺序是从左到右从上到下
# 创建子图后绘制图表,会绘制到最后一个子图ax2 = fig.add_subplot(2,2,2)  # 第一行的右图
ax2.hist(np.random.rand(50),alpha=0.5)ax4 = fig.add_subplot(2,2,4)  # 第二行的右图
df2 = pd.DataFrame(np.random.rand(10, 4), columns=['a', 'b', 'c', 'd'])
ax4.plot(df2,alpha=0.5,linestyle='--',marker='.')
# 也可以直接在子图后用图表创建函数直接生成图表
<IPython.core.display.Javascript object>

[<matplotlib.lines.Line2D at 0x7fadfc309748>,<matplotlib.lines.Line2D at 0x7fadfc309978>,<matplotlib.lines.Line2D at 0x7fadfc309ac8>,<matplotlib.lines.Line2D at 0x7fadfc309c18>]
# 子图创建2 - 创建一个新的figure,并返回一个subplot对象的numpy数组 → plt.subplotfig,axes = plt.subplots(2,3,figsize=(10,4))
ts = pd.Series(np.random.randn(1000).cumsum())
print(axes, axes.shape, type(axes))
# 生成图表对象的数组ax1 = axes[0,1]
ax1.plot(ts)
<IPython.core.display.Javascript object>

[[<matplotlib.axes._subplots.AxesSubplot object at 0x7fadfc72e358><matplotlib.axes._subplots.AxesSubplot object at 0x7fadfc6d05f8><matplotlib.axes._subplots.AxesSubplot object at 0x7fadfc6de908>][<matplotlib.axes._subplots.AxesSubplot object at 0x7fadfc692358><matplotlib.axes._subplots.AxesSubplot object at 0x7fadfc6b6828><matplotlib.axes._subplots.AxesSubplot object at 0x7fadfc658898>]] (2, 3) <class 'numpy.ndarray'>[<matplotlib.lines.Line2D at 0x7fadfc67b908>]
# plt.subplots,参数调整fig,axes = plt.subplots(2,2,sharex=True,sharey=True)
# sharex,sharey:是否共享x,y刻度for i in range(2):for j in range(2):axes[i,j].hist(np.random.randn(500),color='k',alpha=0.5)
plt.subplots_adjust(wspace=0,hspace=0)
# wspace,hspace:用于控制宽度和高度的百分比,比如subplot之间的间距
<IPython.core.display.Javascript object>

# 子图创建3 - 多系列图,分别绘制df = pd.DataFrame(np.random.randn(1000, 4), index=ts.index, columns=list('ABCD'))
df = df.cumsum()
df.plot(style = '--.',alpha = 0.4,grid = True,figsize = (8,8),subplots = True,layout = (2,3),sharex = False)
plt.subplots_adjust(wspace=0,hspace=0.2)
# plt.plot()基本图表绘制函数 → subplots,是否分别绘制系列(子图)
# layout:绘制子图矩阵,按顺序填充
<IPython.core.display.Javascript object>

课程3.6 基本图表绘制 plt.plot()

图表类别:线形图、柱状图、密度图,以横纵坐标两个维度为主
同时可延展出多种其他图表样式

plt.plot(kind=‘line’, ax=None, figsize=None, use_index=True, title=None, grid=None, legend=False,
style=None, logx=False, logy=False, loglog=False, xticks=None, yticks=None, xlim=None, ylim=None,
rot=None, fontsize=None, colormap=None, table=False, yerr=None, xerr=None, label=None, secondary_y=False, **kwds)

import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
% matplotlib inline
# Series直接生成图表ts = pd.Series(np.random.randn(1000), index=pd.date_range('1/1/2000', periods=1000))
ts = ts.cumsum()
ts.plot(kind='line',label = 'hehe',style = '--g.',color = 'red',alpha = 0.4,use_index = True,rot = 45,grid = True,ylim = [-50,50],yticks = list(range(-50,50,10)),figsize = (8,4),title = 'test',legend = True)
#plt.grid(True, linestyle = "--",color = "gray", linewidth = "0.5",axis = 'x')  # 网格
plt.legend()
# Series.plot():series的index为横坐标,value为纵坐标
# kind → line,bar,barh...(折线图,柱状图,柱状图-横...)
# label → 图例标签,Dataframe格式以列名为label
# style → 风格字符串,这里包括了linestyle(-),marker(.),color(g)
# color → 颜色,有color指定时候,以color颜色为准
# alpha → 透明度,0-1
# use_index → 将索引用为刻度标签,默认为True
# rot → 旋转刻度标签,0-360
# grid → 显示网格,一般直接用plt.grid
# xlim,ylim → x,y轴界限
# xticks,yticks → x,y轴刻度值
# figsize → 图像大小
# title → 图名
# legend → 是否显示图例,一般直接用plt.legend()
# 也可以 → plt.plot()
<matplotlib.legend.Legend at 0x7f062a9bbf28>

# Dataframe直接生成图表df = pd.DataFrame(np.random.randn(1000, 4), index=ts.index, columns=list('ABCD'))
df = df.cumsum()
df.plot(kind='line',style = '--.',alpha = 0.4,use_index = True,rot = 45,grid = True,figsize = (8,4),title = 'test',legend = True,subplots = False,colormap = 'Greens')
# subplots → 是否将各个列绘制到不同图表,默认False
# 也可以 → plt.plot(df)
<matplotlib.axes._subplots.AxesSubplot at 0x9b9aba8>

课程3.7 柱状图、堆叠图

plt.plot(kind=‘bar/barh’) , plt.bar()

# 柱状图与堆叠图fig,axes = plt.subplots(4,1,figsize = (10,10))
s = pd.Series(np.random.randint(0,10,16),index = list('abcdefghijklmnop'))
df = pd.DataFrame(np.random.rand(10,3), columns=['a','b','c'])s.plot(kind='bar',color = 'k',grid = True,alpha = 0.5,ax = axes[0])  # ax参数 → 选择第几个子图
# 单系列柱状图方法一:plt.plot(kind='bar/barh')df.plot(kind='bar',ax = axes[1],grid = True,colormap='Reds_r')
# 多系列柱状图df.plot(kind='bar',ax = axes[2],grid = True,colormap='Blues_r',stacked=True)
# 多系列堆叠图
# stacked → 堆叠df.plot.barh(ax = axes[3],grid = True,stacked=True,colormap = 'BuGn_r')
# 新版本plt.plot.<kind>
<matplotlib.axes._subplots.AxesSubplot at 0xb336f60>

# 柱状图 plt.bar()plt.figure(figsize=(10,4))
x = np.arange(10)
y1 = np.random.rand(10)
y2 = -np.random.rand(10)plt.bar(x,y1,width = 1,facecolor = 'yellowgreen',edgecolor = 'white',yerr = y1*0.1)
plt.bar(x,y2,width = 1,facecolor = 'lightskyblue',edgecolor = 'white',yerr = y2*0.1)
# x,y参数:x,y值
# width:宽度比例
# facecolor柱状图里填充的颜色、edgecolor是边框的颜色
# left-每个柱x轴左边界,bottom-每个柱y轴下边界 → bottom扩展即可化为甘特图 Gantt Chart
# align:决定整个bar图分布,默认left表示默认从左边界开始绘制,center会将图绘制在中间位置
# xerr/yerr :x/y方向error barfor i,j in zip(x,y1):plt.text(i+0.3,j-0.15,'%.2f' % j, color = 'white')
for i,j in zip(x,y2):plt.text(i+0.3,j+0.05,'%.2f' % -j, color = 'white')
# 给图添加text
# zip() 函数用于将可迭代的对象作为参数,将对象中对应的元素打包成一个个元组,然后返回由这些元组组成的列表。

# 外嵌图表plt.table()
# table(cellText=None, cellColours=None,cellLoc='right', colWidths=None,rowLabels=None, rowColours=None, rowLoc='left',
# colLabels=None, colColours=None, colLoc='center',loc='bottom', bbox=None)data = [[ 66386, 174296,  75131, 577908,  32015],[ 58230, 381139,  78045,  99308, 160454],[ 89135,  80552, 152558, 497981, 603535],[ 78415,  81858, 150656, 193263,  69638],[139361, 331509, 343164, 781380,  52269]]
columns = ('Freeze', 'Wind', 'Flood', 'Quake', 'Hail')
rows = ['%d year' % x for x in (100, 50, 20, 10, 5)]
df = pd.DataFrame(data,columns = ('Freeze', 'Wind', 'Flood', 'Quake', 'Hail'),index = ['%d year' % x for x in (100, 50, 20, 10, 5)])
print(df)df.plot(kind='bar',grid = True,colormap='Blues_r',stacked=True,figsize=(8,3))
# 创建堆叠图plt.table(cellText = data,cellLoc='center',cellColours = None,rowLabels = rows,rowColours = plt.cm.BuPu(np.linspace(0, 0.5,5))[::-1],  # BuPu可替换成其他colormapcolLabels = columns,colColours = plt.cm.Reds(np.linspace(0, 0.5,5))[::-1], rowLoc='right',loc='bottom')
# cellText:表格文本
# cellLoc:cell内文本对齐位置
# rowLabels:行标签
# colLabels:列标签
# rowLoc:行标签对齐位置
# loc:表格位置 → left,right,top,bottomplt.xticks([])
# 不显示x轴标注
          Freeze    Wind   Flood   Quake    Hail
100 year   66386  174296   75131  577908   32015
50 year    58230  381139   78045   99308  160454
20 year    89135   80552  152558  497981  603535
10 year    78415   81858  150656  193263   69638
5 year    139361  331509  343164  781380   52269([], <a list of 0 Text xticklabel objects>)

3.8 面积图、填图、饼图

plt.plot.area()
plt.fill(), plt.fill_between()
plt.pie()

# 面积图fig,axes = plt.subplots(2,1,figsize = (8,6))
df1 = pd.DataFrame(np.random.rand(10, 4), columns=['a', 'b', 'c', 'd'])
df2 = pd.DataFrame(np.random.randn(10, 4), columns=['a', 'b', 'c', 'd'])df1.plot.area(colormap = 'Greens_r',alpha = 0.5,ax = axes[0])
df2.plot.area(stacked=False,colormap = 'Set2',alpha = 0.5,ax = axes[1])
# 使用Series.plot.area()和DataFrame.plot.area()创建面积图
# stacked:是否堆叠,默认情况下,区域图被堆叠
# 为了产生堆积面积图,每列必须是正值或全部负值!
# 当数据有NaN时候,自动填充0,所以图标签需要清洗掉缺失值
<matplotlib.axes._subplots.AxesSubplot at 0xc079240>

# 填图fig,axes = plt.subplots(2,1,figsize = (8,6))x = np.linspace(0, 1, 500)
y1 = np.sin(4 * np.pi * x) * np.exp(-5 * x)
y2 = -np.sin(4 * np.pi * x) * np.exp(-5 * x)
axes[0].fill(x, y1, 'r',alpha=0.5,label='y1')
axes[0].fill(x, y2, 'g',alpha=0.5,label='y2')
# 对函数与坐标轴之间的区域进行填充,使用fill函数
# 也可写成:plt.fill(x, y1, 'r',x, y2, 'g',alpha=0.5)x = np.linspace(0, 5 * np.pi, 1000)
y1 = np.sin(x)
y2 = np.sin(2 * x)
axes[1].fill_between(x, y1, y2, color ='b',alpha=0.5,label='area')
# 填充两个函数之间的区域,使用fill_between函数for i in range(2):axes[i].legend()axes[i].grid()
# 添加图例、格网

# 饼图 plt.pie()
# plt.pie(x, explode=None, labels=None, colors=None, autopct=None, pctdistance=0.6, shadow=False, labeldistance=1.1, startangle=None,
# radius=None, counterclock=True, wedgeprops=None, textprops=None, center=(0, 0), frame=False, hold=None, data=None)s = pd.Series(3 * np.random.rand(4), index=['a', 'b', 'c', 'd'], name='series')
plt.axis('equal')  # 保证长宽相等
plt.pie(s,explode = [0.1,0,0,0],labels = s.index,colors=['r', 'g', 'b', 'c'],autopct='%.2f%%',pctdistance=0.6,labeldistance = 1.2,shadow = True,startangle=0,radius=1.5,frame=False)
print(s)
# 第一个参数:数据
# explode:指定每部分的偏移量
# labels:标签
# colors:颜色
# autopct:饼图上的数据标签显示方式
# pctdistance:每个饼切片的中心和通过autopct生成的文本开始之间的比例
# labeldistance:被画饼标记的直径,默认值:1.1
# shadow:阴影
# startangle:开始角度
# radius:半径
# frame:图框
# counterclock:指定指针方向,顺时针或者逆时针
a    0.573192
b    0.199737
c    0.781543
d    1.995232
Name: series, dtype: float64

3.9 直方图

plt.hist(x, bins=10, range=None, normed=False, weights=None, cumulative=False, bottom=None,
histtype=‘bar’, align=‘mid’, orientation=‘vertical’,rwidth=None, log=False, color=None, label=None,
stacked=False, hold=None, data=None, **kwargs)

# 直方图+密度图s = pd.Series(np.random.randn(1000))
s.hist(bins = 20,histtype = 'bar',align = 'mid',orientation = 'vertical',alpha=0.5,normed =True)
# bin:箱子的宽度
# normed 标准化
# histtype 风格,bar,barstacked,step,stepfilled
# orientation 水平还是垂直{‘horizontal’, ‘vertical’}
# align : {‘left’, ‘mid’, ‘right’}, optional(对齐方式)s.plot(kind='kde',style='k--')
# 密度图
<matplotlib.axes._subplots.AxesSubplot at 0xb9b69b0>

# 堆叠直方图plt.figure(num=1)
df = pd.DataFrame({'a': np.random.randn(1000) + 1, 'b': np.random.randn(1000),'c': np.random.randn(1000) - 1, 'd': np.random.randn(1000)-2},columns=['a', 'b', 'c','d'])
df.plot.hist(stacked=True,bins=20,colormap='Greens_r',alpha=0.5,grid=True)
# 使用DataFrame.plot.hist()和Series.plot.hist()方法绘制
# stacked:是否堆叠df.hist(bins=50)
# 生成多个直方图
array([[<matplotlib.axes._subplots.AxesSubplot object at 0x000000000E3E70B8>,<matplotlib.axes._subplots.AxesSubplot object at 0x000000000C0F50F0>],[<matplotlib.axes._subplots.AxesSubplot object at 0x000000000BA11E48>,<matplotlib.axes._subplots.AxesSubplot object at 0x000000000E434B70>]], dtype=object)<matplotlib.figure.Figure at 0xbcbbb00>

3.10 散点图、矩阵散点图

plt.scatter(), pd.scatter_matrix()

# plt.scatter()散点图
# plt.scatter(x, y, s=20, c=None, marker='o', cmap=None, norm=None, vmin=None, vmax=None,
# alpha=None, linewidths=None, verts=None, edgecolors=None, hold=None, data=None, **kwargs)plt.figure(figsize=(8,6))
x = np.random.randn(1000)
y = np.random.randn(1000)
plt.scatter(x,y,marker='.',s = np.random.randn(1000)*100,cmap = 'Reds',c = y,alpha = 0.8,)
plt.grid()
# s:散点的大小
# c:散点的颜色
# vmin,vmax:亮度设置,标量
# cmap:colormap
/home/nbuser/anaconda3_420/lib/python3.5/site-packages/matplotlib/collections.py:853: RuntimeWarning: invalid value encountered in sqrtscale = np.sqrt(self._sizes) * dpi / 72.0 * self._factor

# pd.scatter_matrix()散点矩阵
# pd.scatter_matrix(frame, alpha=0.5, figsize=None, ax=None,
# grid=False, diagonal='hist', marker='.', density_kwds=None, hist_kwds=None, range_padding=0.05, **kwds)df = pd.DataFrame(np.random.randn(100,4),columns = ['a','b','c','d'])
pd.scatter_matrix(df,figsize=(10,6),marker = 'o',diagonal='kde',alpha = 0.5,range_padding=0.1)
# diagonal:({‘hist’, ‘kde’}),必须且只能在{‘hist’, ‘kde’}中选择1个 → 每个指标的频率图
# range_padding:(float, 可选),图像在x轴、y轴原点附近的留白(padding),该值越大,留白距离越大,图像远离坐标原点
array([[<matplotlib.axes._subplots.AxesSubplot object at 0x000000000E55AB38>,<matplotlib.axes._subplots.AxesSubplot object at 0x000000000E889320>,<matplotlib.axes._subplots.AxesSubplot object at 0x000000000E8D1EF0>,<matplotlib.axes._subplots.AxesSubplot object at 0x000000000E911518>],[<matplotlib.axes._subplots.AxesSubplot object at 0x000000000E95AFD0>,<matplotlib.axes._subplots.AxesSubplot object at 0x000000000E99C080>,<matplotlib.axes._subplots.AxesSubplot object at 0x000000000E9E5C50>,<matplotlib.axes._subplots.AxesSubplot object at 0x000000000E5403C8>],[<matplotlib.axes._subplots.AxesSubplot object at 0x000000000E84DAC8>,<matplotlib.axes._subplots.AxesSubplot object at 0x000000000E4085C0>,<matplotlib.axes._subplots.AxesSubplot object at 0x000000000D1384A8>,<matplotlib.axes._subplots.AxesSubplot object at 0x000000000D17D5F8>],[<matplotlib.axes._subplots.AxesSubplot object at 0x000000000E3A19E8>,<matplotlib.axes._subplots.AxesSubplot object at 0x000000000CE99128>,<matplotlib.axes._subplots.AxesSubplot object at 0x000000000D0D73C8>,<matplotlib.axes._subplots.AxesSubplot object at 0x000000000EA51F98>]], dtype=object)

3.11 极坐标图

调用subplot()创建子图时通过设置projection=‘polar’,便可创建一个极坐标子图,然后调用plot()在极坐标子图中绘图

# 创建极坐标轴s = pd.Series(np.arange(20))
theta=np.arange(0,2*np.pi,0.02)
print(s.head())
print(theta[:10])
# 创建数据fig = plt.figure(figsize=(8,4))
ax1 = plt.subplot(121, projection = 'polar')
ax2 = plt.subplot(122)
# 创建极坐标子图
# 还可以写:ax = fig.add_subplot(111,polar=True)ax1.plot(theta,theta*3,linestyle = '--',lw=1)
ax1.plot(s, linestyle = '--', marker = '.',lw=2)
ax2.plot(theta,theta*3,linestyle = '--',lw=1)
ax2.plot(s)
plt.grid()
# 创建极坐标图,参数1为角度(弧度制),参数2为value
# lw → 线宽
0    0
1    1
2    2
3    3
4    4
dtype: int32
[ 0.    0.02  0.04  0.06  0.08  0.1   0.12  0.14  0.16  0.18]

# 极坐标参数设置theta=np.arange(0,2*np.pi,0.02)
plt.figure(figsize=(8,4))
ax1= plt.subplot(121, projection='polar')
ax2= plt.subplot(122, projection='polar')
ax1.plot(theta,theta/6,'--',lw=2)
ax2.plot(theta,theta/6,'--',lw=2)
# 创建极坐标子图axax2.set_theta_direction(-1)
# set_theta_direction():坐标轴正方向,默认逆时针ax2.set_thetagrids(np.arange(0.0, 360.0, 90),['a','b','c','d'])
ax2.set_rgrids(np.arange(0.2,2,0.4))
# set_thetagrids():设置极坐标角度网格线显示及标签 → 网格和标签数量一致
# set_rgrids():设置极径网格线显示,其中参数必须是正数ax2.set_theta_offset(np.pi/2)
# set_theta_offset():设置角度偏移,逆时针,弧度制ax2.set_rlim(0.2,1.2)
ax2.set_rmax(2)
ax2.set_rticks(np.arange(0.1, 1.5, 0.2))
# set_rlim():设置显示的极径范围
# set_rmax():设置显示的极径最大值
# set_rticks():设置极径网格线的显示范围
[<matplotlib.axis.YTick at 0xec59fd0>,<matplotlib.axis.YTick at 0xec5fc50>,<matplotlib.axis.YTick at 0xec7dc50>,<matplotlib.axis.YTick at 0xec813c8>,<matplotlib.axis.YTick at 0xec81b00>,<matplotlib.axis.YTick at 0xec76160>,<matplotlib.axis.YTick at 0xec84a90>]

# 雷达图1 - 极坐标的折线图/填图 - plt.plot()plt.figure(figsize=(8,4))ax1= plt.subplot(111, projection='polar')
ax1.set_title('radar map\n')  # 创建标题
ax1.set_rlim(0,12)data1 = np.random.randint(1,10,10)
data2 = np.random.randint(1,10,10)
data3 = np.random.randint(1,10,10)
theta=np.arange(0,2*np.pi,2*np.pi/10)
# 创建数据ax1.plot(theta,data1,'.--',label='data1')
ax1.fill(theta,data1,alpha=0.2)
ax1.plot(theta,data2,'.--',label='data2')
ax1.fill(theta,data2,alpha=0.2)
ax1.plot(theta,data3,'.--',label='data3')
ax1.fill(theta,data3,alpha=0.2)
# 绘制雷达线
[<matplotlib.patches.Polygon at 0xf011f98>]

# 雷达图2 - 极坐标的折线图/填图 - plt.polar()
# 首尾闭合labels = np.array(['a','b','c','d','e','f']) # 标签
dataLenth = 6 # 数据长度
data1 = np.random.randint(0,10,6)
data2 = np.random.randint(0,10,6) # 数据angles = np.linspace(0, 2*np.pi, dataLenth, endpoint=False) # 分割圆周长
data1 = np.concatenate((data1, [data1[0]])) # 闭合
data2 = np.concatenate((data2, [data2[0]])) # 闭合
angles = np.concatenate((angles, [angles[0]])) # 闭合plt.polar(angles, data1, 'o-', linewidth=1) #做极坐标系
plt.fill(angles, data1, alpha=0.25)# 填充
plt.polar(angles, data2, 'o-', linewidth=1) #做极坐标系
plt.fill(angles, data2, alpha=0.25)# 填充plt.thetagrids(angles * 180/np.pi, labels) # 设置网格、标签
plt.ylim(0,10)  # polar的极值设置为ylim
(0, 10)

# 极轴图 - 极坐标的柱状图plt.figure(figsize=(8,4))ax1= plt.subplot(111, projection='polar')
ax1.set_title('radar map\n')  # 创建标题
ax1.set_rlim(0,12)data = np.random.randint(1,10,10)
theta=np.arange(0,2*np.pi,2*np.pi/10)
# 创建数据bar = ax1.bar(theta,data,alpha=0.5)
for r,bar in zip(data, bar):bar.set_facecolor(plt.cm.jet(r/10.))  # 设置颜色
plt.thetagrids(np.arange(0.0, 360.0, 90), []) # 设置网格、标签(这里是空标签,则不显示内容)
(<a list of 8 Line2D thetagridline objects>,<a list of 4 Text thetagridlabel objects>)

3.12 箱型图

箱型图:又称为盒须图、盒式图、盒状图或箱线图,是一种用作显示一组数据分散情况资料的统计图
包含一组数据的:最大值、最小值、中位数、上四分位数(Q3)、下四分位数(Q1)、异常值
① 中位数 → 一组数据平均分成两份,中间的数
② 上四分位数Q1 → 是将序列平均分成四份,计算(n+1)/4与(n-1)/4两种,一般使用(n+1)/4
③ 下四分位数Q3 → 是将序列平均分成四份,计算(1+n)/4*3=6.75
④ 内限 → T形的盒须就是内限,最大值区间Q3+1.5IQR,最小值区间Q1-1.5IQR (IQR=Q3-Q1)
⑤ 外限 → T形的盒须就是内限,最大值区间Q3+3IQR,最小值区间Q1-3IQR (IQR=Q3-Q1)
⑥ 异常值 → 内限之外 - 中度异常,外限之外 - 极度异常

plt.plot.box(),plt.boxplot()

# plt.plot.box()绘制fig,axes = plt.subplots(2,1,figsize=(10,6))
df = pd.DataFrame(np.random.rand(10, 5), columns=['A', 'B', 'C', 'D', 'E'])
color = dict(boxes='DarkGreen', whiskers='DarkOrange', medians='DarkBlue', caps='Gray')
# 箱型图着色
# boxes → 箱线
# whiskers → 分位数与error bar横线之间竖线的颜色
# medians → 中位数线颜色
# caps → error bar横线颜色df.plot.box(ylim=[0,1.2],grid = True,color = color,ax = axes[0])
# color:样式填充df.plot.box(vert=False, positions=[1, 4, 5, 6, 8],ax = axes[1],grid = True,color = color)
# vert:是否垂直,默认True
# position:箱型图占位
<matplotlib.axes._subplots.AxesSubplot at 0xecb4748>

# plt.boxplot()绘制
# pltboxplot(x, notch=None, sym=None, vert=None, whis=None, positions=None, widths=None, patch_artist=None, bootstrap=None,
# usermedians=None, conf_intervals=None, meanline=None, showmeans=None, showcaps=None, showbox=None, showfliers=None, boxprops=None,
# labels=None, flierprops=None, medianprops=None, meanprops=None, capprops=None, whiskerprops=None, manage_xticks=True, autorange=False,
# zorder=None, hold=None, data=None)df = pd.DataFrame(np.random.rand(10, 5), columns=['A', 'B', 'C', 'D', 'E'])
plt.figure(figsize=(10,4))
# 创建图表、数据f = df.boxplot(sym = 'o',  # 异常点形状,参考markervert = True,  # 是否垂直whis = 1.5,  # IQR,默认1.5,也可以设置区间比如[5,95],代表强制上下边缘为数据95%和5%位置patch_artist = True,  # 上下四分位框内是否填充,True为填充meanline = False,showmeans=True,  # 是否有均值线及其形状showbox = True,  # 是否显示箱线showcaps = True,  # 是否显示边缘线showfliers = True,  # 是否显示异常值notch = False,  # 中间箱体是否缺口return_type='dict'  # 返回类型为字典)
plt.title('boxplot')
print(f)for box in f['boxes']:box.set( color='b', linewidth=1)        # 箱体边框颜色box.set( facecolor = 'b' ,alpha=0.5)    # 箱体内部填充颜色
for whisker in f['whiskers']:whisker.set(color='k', linewidth=0.5,linestyle='-')
for cap in f['caps']:cap.set(color='gray', linewidth=2)
for median in f['medians']:median.set(color='DarkBlue', linewidth=2)
for flier in f['fliers']:flier.set(marker='o', color='y', alpha=0.5)
# boxes, 箱线
# medians, 中位值的横线,
# whiskers, 从box到error bar之间的竖线.
# fliers, 异常值
# caps, error bar横线
# means, 均值的横线,
{'caps': [<matplotlib.lines.Line2D object at 0x0000000010042CF8>, <matplotlib.lines.Line2D object at 0x0000000010047BE0>, <matplotlib.lines.Line2D object at 0x0000000010057C88>, <matplotlib.lines.Line2D object at 0x000000001005DB70>, <matplotlib.lines.Line2D object at 0x000000001006EC18>, <matplotlib.lines.Line2D object at 0x0000000010074B00>, <matplotlib.lines.Line2D object at 0x0000000010085BA8>, <matplotlib.lines.Line2D object at 0x000000001008BA90>, <matplotlib.lines.Line2D object at 0x00000000104896D8>, <matplotlib.lines.Line2D object at 0x00000000104998D0>], 'whiskers': [<matplotlib.lines.Line2D object at 0x0000000010042198>, <matplotlib.lines.Line2D object at 0x0000000010042B70>, <matplotlib.lines.Line2D object at 0x0000000010057208>, <matplotlib.lines.Line2D object at 0x0000000010057B00>, <matplotlib.lines.Line2D object at 0x000000001006E198>, <matplotlib.lines.Line2D object at 0x000000001006EA90>, <matplotlib.lines.Line2D object at 0x0000000010085128>, <matplotlib.lines.Line2D object at 0x0000000010085A20>, <matplotlib.lines.Line2D object at 0x000000001009B0B8>, <matplotlib.lines.Line2D object at 0x000000001009B9B0>], 'medians': [<matplotlib.lines.Line2D object at 0x0000000010047D68>, <matplotlib.lines.Line2D object at 0x000000001005DCF8>, <matplotlib.lines.Line2D object at 0x0000000010074C88>, <matplotlib.lines.Line2D object at 0x000000001008BC18>, <matplotlib.lines.Line2D object at 0x0000000010497828>], 'fliers': [<matplotlib.lines.Line2D object at 0x000000001004CD30>, <matplotlib.lines.Line2D object at 0x0000000010062CC0>, <matplotlib.lines.Line2D object at 0x000000001007BC50>, <matplotlib.lines.Line2D object at 0x0000000010090BE0>, <matplotlib.lines.Line2D object at 0x00000000100A37B8>], 'means': [<matplotlib.lines.Line2D object at 0x000000001004C5C0>, <matplotlib.lines.Line2D object at 0x0000000010062550>, <matplotlib.lines.Line2D object at 0x000000001007B4E0>, <matplotlib.lines.Line2D object at 0x0000000010090470>, <matplotlib.lines.Line2D object at 0x00000000102CFC18>], 'boxes': [<matplotlib.patches.PathPatch object at 0x00000000104BAB00>, <matplotlib.patches.PathPatch object at 0x0000000010051C50>, <matplotlib.patches.PathPatch object at 0x0000000010069B00>, <matplotlib.patches.PathPatch object at 0x000000001007EA90>, <matplotlib.patches.PathPatch object at 0x0000000010096B00>]}

# plt.boxplot()绘制
# 分组汇总df = pd.DataFrame(np.random.rand(10,2), columns=['Col1', 'Col2'] )
df['X'] = pd.Series(['A','A','A','A','A','B','B','B','B','B'])
df['Y'] = pd.Series(['A','B','A','B','A','B','A','B','A','B'])
print(df.head())
df.boxplot(by = 'X')
df.boxplot(column=['Col1','Col2'], by=['X','Y'])
# columns:按照数据的列分子图
# by:按照列分组做箱型图
       Col1      Col2  X  Y
0  0.884439  0.801121  A  A
1  0.802741  0.390957  A  B
2  0.139452  0.805676  A  A
3  0.030047  0.571676  A  B
4  0.654272  0.733307  A  Aarray([<matplotlib.axes._subplots.AxesSubplot object at 0x0000000010176588>,<matplotlib.axes._subplots.AxesSubplot object at 0x00000000101BFB00>], dtype=object)

python数据分析工具3:matplotlib相关推荐

  1. Python 数据分析三剑客之 Matplotlib(十一):最常用最有价值的 50 个图表

    CSDN 课程推荐:<Python 数据分析与挖掘>,讲师刘顺祥,浙江工商大学统计学硕士,数据分析师,曾担任唯品会大数据部担任数据分析师一职,负责支付环节的数据分析业务.曾与联想.亨氏.网 ...

  2. Python 数据分析三剑客之 Matplotlib(一):初识 Matplotlib 与其 matplotibrc 配置文件

    CSDN 课程推荐:<Python 数据分析与挖掘>,讲师刘顺祥,浙江工商大学统计学硕士,数据分析师,曾担任唯品会大数据部担任数据分析师一职,负责支付环节的数据分析业务.曾与联想.亨氏.网 ...

  3. python解题软件哪个好用_几个好用的Python数据分析工具

    原标题:几个好用的Python数据分析工具 ​常用的Python数据分析工具汇总! Python是数据处理常用工具,可以处理数量级从几K至几T不等的数据,具有较高的开发效率和可维护性,还具有较强的通用 ...

  4. pandas强大的Python数据分析工具

    指数 模块 | 下一页 | 熊猫0.22.0文档 » 目录 什么是新的 安装 贡献给大熊猫 包概述 10分钟到熊猫 教程 食谱 数据结构简介 基本的基本功能 使用文本数据 选项和设置 索引和选择数据 ...

  5. Python数据分析工具

    一.Python数据分析工具 ![](https://img-blog.csdnimg.cn/20190417153008529.png?x-oss- process=image/watermark, ...

  6. Python数据分析工具,主要有哪些?

    python数据分析工具一:IPython IPython是一个在多种编程语言之间进行交互计算的命令行shell,最开始是用python开发的,提供增强的内省,富媒体,扩展的shell语法,tab补全 ...

  7. Python 数据分析三剑客之 Matplotlib(十):3D 图的绘制

    CSDN 课程推荐:<Python 数据分析与挖掘>,讲师刘顺祥,浙江工商大学统计学硕士,数据分析师,曾担任唯品会大数据部担任数据分析师一职,负责支付环节的数据分析业务.曾与联想.亨氏.网 ...

  8. Python 数据分析三剑客之 Matplotlib(九):极区图 / 极坐标图 / 雷达图的绘制

    CSDN 课程推荐:<Python 数据分析与挖掘>,讲师刘顺祥,浙江工商大学统计学硕士,数据分析师,曾担任唯品会大数据部担任数据分析师一职,负责支付环节的数据分析业务.曾与联想.亨氏.网 ...

  9. Python 数据分析三剑客之 Matplotlib(八):等高线 / 等值线图的绘制

    CSDN 课程推荐:<Python 数据分析与挖掘>,讲师刘顺祥,浙江工商大学统计学硕士,数据分析师,曾担任唯品会大数据部担任数据分析师一职,负责支付环节的数据分析业务.曾与联想.亨氏.网 ...

  10. Python 数据分析三剑客之 Matplotlib(七):饼状图的绘制

    CSDN 课程推荐:<Python 数据分析与挖掘>,讲师刘顺祥,浙江工商大学统计学硕士,数据分析师,曾担任唯品会大数据部担任数据分析师一职,负责支付环节的数据分析业务.曾与联想.亨氏.网 ...

最新文章

  1. Java序列化接口的作用总结1
  2. Java性能优化(12):最小化类和成员可访问能力
  3. 为什么单击用户账户没有反应_为什么您的网站没有流量?是因为用户搜不到你!...
  4. esp8266数据上传到mysql数据库_03-STM32+ESP8266+AIR202/302终端管理篇-把设备温湿度数据存储到MySQL数据库(Windows)...
  5. 你有没有靠谱的基因?一个人靠不靠谱,其实就看这三点:“凡事有交代,件件有着落,事事有回音。”...
  6. session很快失效_一口气说出 4 种分布式一致性 Session 实现方式,面试杠杠的~
  7. 工作总结4:拦截器的使用
  8. 【转】CT球管小知识--热容量
  9. 信号扫描_图文并茂,一文读懂信号源
  10. 机器学习--线性回归(LinearRegression)
  11. ubuntu 绑定网卡
  12. stm32 USART rs485 rs232
  13. 面试中的字符串问题 (1)
  14. PreparedStatement 防止 SQL 注入原理
  15. 灵格斯!优秀的翻译软件!!!
  16. linux-tar命令
  17. 百度地图API学习 - 点击地图显示为中心点
  18. 1092 最好吃的月饼
  19. QQ语音通话通过蓝牙发送语音给耳机的一些问题(Android O)
  20. HiWork发布1.7.0新版本——可开启频道公开链接,增加HiWork客服功能及集成应用麦客

热门文章

  1. Kubernetes全套笔记
  2. 蓝桥杯训练题1427: [蓝桥杯][2013年第四届真题]买不到的数目【筛选符合题目的数字。有点类似筛素数】
  3. Java学习-ATM系统
  4. UGUI源码分析:开关组件Toggle与ToggleGroup
  5. 文件服务器隐藏netlogon,lanmanworkstation-netlogon服务无法自启,该如何处理?各位大侠好,此台服务器 爱问知识人...
  6. 构筑基于物联网操作系统的物联网生态环境
  7. 编程:随机生成1-100之间的数字,如果猜对了结束游戏,如果猜错则继续猜并提示所猜测的数字是大于还是小于所指定的数,最终提示猜对所用的次数。
  8. Linux系统编译安装GDAL库
  9. (附源码)计算机毕业设计SSM基于ETC用户的自驾游推荐系统
  10. 【苹果家庭推送】iMessage Number是一种及时静态(Differential Privacy)