码迷,mamicode.com
首页 > 编程语言 > 详细

Python中matplotlib模块的简单使用

时间:2019-05-19 20:38:51      阅读:140      评论:0      收藏:0      [点我收藏+]

标签:plt   折线   http   pyplot   enc   info   com   bsp   atp   

测试代码如下:

 1 # encoding:utf-8
 2 import numpy as np
 3 import matplotlib.pyplot as plt
 4 x = np.array([1,2,3,4,5,6,7,8])
 5 y = np.array([3,5,7,6,2,6,10,15])
 6 plt.plot(x,y,r)# 折线 1 x 2 y 3 color
 7 plt.plot(x,y,g,lw=10)# 4 line w
 8 # 折线 饼状 柱状
 9 x = np.array([1,2,3,4,5,6,7,8])
10 y = np.array([13,25,17,36,21,16,10,15])
11 plt.bar(x,y,0.2,alpha=1,color=b)# 5 color 4 透明度 3 0.9
12 plt.show()

运行结果如下:

技术图片

 

Python中matplotlib模块的简单使用

标签:plt   折线   http   pyplot   enc   info   com   bsp   atp   

原文地址:https://www.cnblogs.com/shixinzei/p/10890560.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!