欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

python数据挖掘包matplotlib绘图

程序员文章站 2022-09-20 15:15:01
模块 官网模块介绍:module matplotlib 是Python最著名的绘图库,它提供了一整套和matlab相似的命令API,十分适合交互式地进行制图。而且也可以方便地将...

模块

官网模块介绍:module
matplotlib 是Python最著名的绘图库,它提供了一整套和matlab相似的命令API,十分适合交互式地进行制图。而且也可以方便地将它作为绘图控件,嵌入GUI应用程序中。它的文档相当完备,并且Gallery页面 中有上百幅缩略图,打开之后都有源程序。因此如果你需要绘制某种类型的图,只需要在这个页面中浏览/复制/粘贴一下,基本上都能搞定。

matplotlib  
    matplotlib.afm  
    matplotlib.animation    
    matplotlib.artist   
    matplotlib.axis 
    matplotlib.backend_bases    
    matplotlib.backend_managers 
    matplotlib.backend_tools    
    matplotlib.backends.backend_pdf 
    matplotlib.backends.backend_qt4agg  
    matplotlib.backends.backend_qt5agg  
    matplotlib.backends.backend_svg 
    matplotlib.backends.backend_wxagg   
    matplotlib.cbook    
    matplotlib.cm   
    matplotlib.collections  
    matplotlib.colorbar 
    matplotlib.colors   
    matplotlib.container    
    matplotlib.dates    
    matplotlib.dviread  
    matplotlib.figure   
    matplotlib.finance  
    matplotlib.font_manager 
    matplotlib.fontconfig_pattern   
    matplotlib.gridspec 
    matplotlib.image    
    matplotlib.legend   
    matplotlib.legend_handler   
    matplotlib.lines    
    matplotlib.markers  
    matplotlib.mathtext 
    matplotlib.mlab 
    matplotlib.offsetbox    
    matplotlib.patches  
    matplotlib.path 
    matplotlib.patheffects  
    matplotlib.projections  
    matplotlib.projections.polar    
    matplotlib.pyplot   
    matplotlib.rcsetup  
    matplotlib.sankey   
    matplotlib.scale    
    matplotlib.sphinxext.plot_directive 
    matplotlib.spines   
    matplotlib.style    
    matplotlib.text 
    matplotlib.ticker   
    matplotlib.tight_layout 
    matplotlib.transforms   
    matplotlib.tri  
    matplotlib.type1font    
    matplotlib.units    
    matplotlib.widgets

绘图基础

matplotlib实际上是一套面向对象的绘图库,它所绘制的图表中的每个绘图元素,例如线条Line2D、文字Text、刻度等在内存中都有一个对象与之对应
为了方便快速绘图matplotlib通过pyplot模块提供了一套和MATLAB类似的绘图API,将众多绘图对象所构成的复杂结构隐藏在这套API内部。我们只需要调用pyplot模块所提供的函数就可以实现快速绘图以及设置图表的各种细节。pyplot模块虽然用法简单,但不适合在较大的应用程序中使用
应用:如何在论文中画出漂亮的插图

matplotlib.pyplot模块

matplotlib的pyplot子库提供了和matlab类似的绘图API,方便用户快速绘制2D图表