作家
登录

高效使用Python可视化工具Matplotlib

作者: 来源: 2017-07-05 05:47:58 阅读 我要评论

, xlabel='Total Revenue', ylabel='Customers'
  •  
  •   
  •  
  • # Plot the average as a vertical line 
  •  
  • avg = top_10['Sales'].mean() 
  •  
  • ax0.axvline(x=avg, color='b', label='Average', linestyle='--', linewidth=1) 
  •  
  •   
  •  
  • # Repeat for the unit plot 
  •  
  • top_10.plot(kind='barh', y="Purchases", x="Name", ax=ax1) 
  •  
  • avg = top_10['Purchases'].mean() 
  •  
  • ax1.set(title='Units', xlabel='Total Units', ylabel=''
  •  
  • ax1.axvline(x=avg, color='b', label='Average', linestyle='--', linewidth=1) 
  •  
  •   
  •  
  • # Title the figure 
  •  
  • fig.suptitle('2014 Sales Analysis', fontsize=14, fontweight='bold'); 
  •  
  •   
  •  
  • # Hide the legends 
  •  
  • ax1.legend().set_visible(False
  •  
  • ax0.legend().set_visible(False 
  • 到今朝为止,我一向用jupyter notebook,借助%matplotlib内联指令来显示图形。然则很多时刻,须要以特定格局保存数字,和其他内容一路展示。

    Matplotlib支撑很多不合格局文件的保存。 你可以用fig.canvas.get_supported_filetypes()查看体系支撑的格局:

    1. fig.canvas.get_supported_filetypes() 
    1. {'eps''Encapsulated Postscript'
    2.  
    3. 'jpeg''Joint Photographic Experts Group'
    4.  
    5. 'jpg''Joint Photographic Experts Group'
    6.  
    7. 'pdf''Portable Document Format'
    8.  
    9. 'pgf''PGF code for LaTeX'
    10.  
    11. 'png''Portable Network Graphics'
    12.  

    13.   推荐阅读

        微服务架构:基于微服务和Docker容器技术的PaaS云平台架构设计(微服务架构实施原理)

      基于微办事架构和Docker容器技巧的PaaS云平台扶植目标是给我们的开辟人员供给一套办事快速开辟、安排、运维治理、持续开辟持续集成的流程。平台供给基本举措措施、中心件、数据办事、云办>>>详细阅读


      本文标题:高效使用Python可视化工具Matplotlib

      地址:http://www.17bianji.com/lsqh/36034.html

    关键词: 探索发现

    乐购科技部分新闻及文章转载自互联网,供读者交流和学习,若有涉及作者版权等问题请及时与我们联系,以便更正、删除或按规定办理。感谢所有提供资讯的网站,欢迎各类媒体与乐购科技进行文章共享合作。

    网友点评
    自媒体专栏

    评论

    热度

    精彩导读
    栏目ID=71的表不存在(操作类型=0)