{"id":345,"date":"2011-09-06T17:27:19","date_gmt":"2011-09-06T15:27:19","guid":{"rendered":"http:\/\/astronomy.lamost.org\/blog\/?p=345"},"modified":"2011-09-06T17:27:19","modified_gmt":"2011-09-06T15:27:19","slug":"matplotlib-%e7%94%bb%e5%9b%be","status":"publish","type":"post","link":"http:\/\/astronomy.lamost.org\/blog\/?p=345","title":{"rendered":"matplotlib \u753b\u56fe"},"content":{"rendered":"<p>\u57fa\u672c\u4e0a2\u7ef4\u70b9\u7ebf\u56fe\u8fd9\u4e9b\u5c31\u591f\u4e86<\/p>\n<p>import matplotlib.pyplot as Plt<br \/>\nfrom\u00a0 matplotlib.mlab import *<br \/>\nimport numpy as Mm<\/p>\n<p>######################## cycle<\/p>\n<p>clour=[&#8216;-&#8216;,&#8217;-.&#8217;,&#8217;&#8211;&#8216;,&#8217;k-&#8216;,&#8217;:&#8217;]<br \/>\nage=[0.2,0.3,0.4,0.5,0.6]<br \/>\nlength=Mm.size(age)<br \/>\nprint length<br \/>\nfor i in range(0,length):<br \/>\nsedname=&#8217;dust_forgrasil_11_newz_&#8217;+str(age[i])+&#8217;Gyr.data&#8217;<br \/>\nsed=load(sedname)<br \/>\nlam=sed[:,0]<br \/>\nflux=sed[:,1]<br \/>\nPlt.plot(lam,flux,clour[i])<\/p>\n<p>############\u00a0 log<br \/>\ny1=Mm.log10(data1[:,2]*(10**(-9)))<\/p>\n<p>############# load<\/p>\n<p>sed=load(&#8216;dust_forgrasil_11_newz_0.5Gyr.data&#8217;)<br \/>\nlam=sed[:,0]<br \/>\nflux=sed[:,1]<br \/>\n################## figure<\/p>\n<p>Plt.figure(1)<br \/>\na=Plt.subplot(111)<\/p>\n<p>################## text<br \/>\nPlt.text(0.5, Mm.log10(220),&#8217;SFR=200 M$_\\odot$&#8217;,color=&#8217;r&#8217;)<br \/>\n################# plot<br \/>\nPlt.plot(lam,flux,&#8217;k-&#8216;,linewidth=2)<\/p>\n<p>########### plot line<br \/>\nPlt.axhline(y=sfry,color=&#8217;r&#8217;)<br \/>\nPlt.axvline(y=sfry,color=&#8217;r&#8217;)<\/p>\n<p>############## plot error<br \/>\nrroryup=data1[0:14,2]<br \/>\nerrorylow=data1[0:14,3]<\/p>\n<p>Plt.errorbar(data1[0:14,0]\/(1+z),data1[0:14,1]\/(1+z),yerr=[errorylow, erroryup],xerr=0,fmt=&#8217;ko&#8217;)<\/p>\n<p>######## axies<\/p>\n<p>Plt.xlabel(r&#8217;$\\lambda_{rest}$ [$\\mu$m]&#8217;,fontsize=20,fontweight=&#8217;bold&#8217;)<br \/>\nPlt.ylabel(r&#8217;$F_{\\nu}$ [$\\mu$Jy]&#8217;,fontsize=20,fontweight=&#8217;bold&#8217;)<br \/>\nPlt.legend((&#8216;0.2Gyr&#8217;,&#8217;0.3Gyr&#8217;,&#8217;0.4Gyr&#8217;,&#8217;0.5Gyr&#8217;,&#8217;0.6Gyr&#8217;),2)<\/p>\n<p>Plt.ylim((1e-2 ,1e4))<\/p>\n<p>a.set_xscale(&#8220;log&#8221;)<br \/>\na.set_yscale(&#8220;log&#8221;)<br \/>\nPlt.savefig(&#8220;paper_age.eps&#8221;)<\/p>\n<p>Plt.show()<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u57fa\u672c\u4e0a2\u7ef4\u70b9\u7ebf\u56fe\u8fd9\u4e9b\u5c31\u591f\u4e86 import matplotlib.pyplot as Plt from\u00a0 mat&#8230;<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-345","post","type-post","status-publish","format-standard","hentry","category-1"],"_links":{"self":[{"href":"http:\/\/astronomy.lamost.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/345","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/astronomy.lamost.org\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/astronomy.lamost.org\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/astronomy.lamost.org\/blog\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/astronomy.lamost.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=345"}],"version-history":[{"count":1,"href":"http:\/\/astronomy.lamost.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/345\/revisions"}],"predecessor-version":[{"id":346,"href":"http:\/\/astronomy.lamost.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/345\/revisions\/346"}],"wp:attachment":[{"href":"http:\/\/astronomy.lamost.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=345"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/astronomy.lamost.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=345"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/astronomy.lamost.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=345"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}