首页 > 其他 > 详细

matplotlib应用

时间:2016-06-07 12:43:06      阅读:266      评论:0      收藏:0      [点我收藏+]
 1 #-*- coding:utf-8 -*-
 2 #
 3 import numpy as np
 4 import matplotlib.pyplot as plt
 5 
 6 x = np.linspace(0,10,1000)
 7 y = np.sin(x)+1
 8 z = np.cos(x**2)+1
 9 
10 plt.figure(figsize=(8,4))
11 plt.plot(x,y,label = $\sin x+1$,color = red,linewidth=2)
12 plt.plot(x,z,b--,label = $\cos x^2+1$)
13 plt.xlabel(Time(s))
14 plt.ylabel(Volt)
15 plt.title(A Simple Example)
16 plt.ylim(0,2.2)
17 plt.legend()
18 plt.show()

matplotlib是数据分析时常用的作图代码,此例中依赖上级库numpy

matplotlib应用

原文:http://www.cnblogs.com/chauncy/p/5566369.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!