您好,欢迎访问三七文档
当前位置:首页 > 商业/管理/HR > 项目/工程管理 > 上机实验10:Eviews作图操作
上机实验10:Eviews7中的图形操作areaareagraph.bandareabandgraph.barbargraph.boxplotboxplotgraph.distplotdistributiongraph.dotdotplotgraph.errbarerrorbargraph.hilohigh-low(-open-close)graph.lineline-symbolgraph.piepiechart.qqplotquantile-quantilegraph.scatscatterplot.scatmatmatrixofscatterplots.scatpairscatterplotpairsgraph.seasplotseasonallinegraph.spikespikegraph.xyareaXYareagraph.xybarXYbargraph.xylineXYlinegraph.xypairXYpairsgraph.一、图形的分类1.线条图,如errbar、hile、line、spike2.填充图,如area、bar、pie3.XY图,如xy、xyline、xypair、scat4.统计图,如boxplot、cdfplot、hist、distplotkernel、qqplot5.其他对象的特有图形,如方程对象的置信椭圆cellipse图形能方便地实现数据和计量分析结果的可视化。图形对象包含对象的图形视图和图形对象。可以把图象视图定格成图形对象再进行修改。二、创建图形对象打开Eviews7,打开demo.wf1文件。图形可以用graph命令创建,也可以从其他对象的图形视图定格而来。如graphgf.linegdp(或graphgfgdp,默认为线条图)用freeze命令把其他对象的图形视图定格成图形对象。如freeze(gf)gdp.linemerge命令是合并已有的图形对象freeze(g1)gdp.lineshowg1graphg2.barm1showg2graphg3.mergegfggshowg3多个子图,用align命令设置排列方式,例如Graphgfan.line(m)log(gdp)log(m1)rsGfan.align(2,1.5,1)45678556065707580859095LOG(GDP)4.85.25.66.06.46.87.2556065707580859095LOG(M1)0481216556065707580859095RS三、定制图形图形对象可以通过程序修改的部分有:线型(pattern)和填充,图例(legend)和图框(frame),坐标轴,还可以在图形对象上增加文本、线和阴影等。1.图框使用options命令,例如graphgf1.linersCopygf1gf2Gf2.optionsindent(缩进)Copygf1gf3Gf3.options–inbox(去掉边框)Copygf1gf4Gf4.optionssize(8,3)(修改为8,3虚拟英寸)Graphgffr.mergegf1gf2gf3gf4Gffr.legend–displayGffr.align(2,1,1)Deletegf?0246810121416195519601965197019751980198519901995RS0246810121416195519601965197019751980198519901995RS0246810121416195519601965197019751980198519901995RS02468101214165254565860626466687072747678808284868890929496RS2.坐标轴有些图形命令,如line,对多个序列作图时,有如下坐标轴选项:a:自动选择坐标轴,横轴在底部,纵轴在左边。d:双坐标轴,第一个序列对应左边的坐标轴,其他序列对应右边的坐标轴,第一个序列的图形与其他序列不相交。x:同d,但允许相交。n:将序列标准化。例如graphgf1.linersprcopygf1gf2gf2.scale(left)log(采用对数坐标)copygf1gf3gf3.setelem(2)axis(right)(将价格水平的坐标放到右边)copygf3gf4gf4.scaleoverlap(允许相交)graphgfas.mergegf1gf2gf3gf4gfas.align(2,2,2)deletegf?showgfas0246810121416195519601965197019751980198519901995RSPR20.010.07.05.03.02.01.00.70.50.30.20.1195519601965197019751980198519901995RSPR04812160.00.20.40.60.81.01.2195519601965197019751980198519901995RSPR0246810121416195519601965197019751980198519901995RSPR命令scale有invert和range等选项,设置反向坐标轴和坐标轴的标注范围。如Graphgf1.linelog(gdp)Copygf1gf2Gf2.scaleinvertCopygf1gf3Gf3.scalelinearzeroCopygf1gf4Gf4.scalerange(4,8)Graphgfa1.mergegf1gf2gf3gf4Gfa1.legend–displayGfa1.align(2,1,1)Deletegf?Showgfa14.44.85.25.66.06.46.87.27.6195519601965197019751980198519901995LOG(GDP)4.44.85.25.66.06.46.87.27.6195519601965197019751980198519901995LOG(GDP)012345678195519601965197019751980198519901995LOG(GDP)4.04.55.05.56.06.57.07.58.0195519601965197019751980198519901995LOG(GDP)坐标的外观,时间标度等也可以进行设置。例如Graphgf1.linelog(rs)Copygf1gf2Gf2.axismirrorzeroline(增加零线,左右同时给出刻度)Copygf1gf3Gf3.datelabelinterval(year,10)(横轴刻度是10年)Copygf1gf4Gf4.axis–labelgridticksin(去掉标度,增加网格线,刻度在里面)Graphgfag.mergegf1gf2gf3gf4Gfag.legend–displayGfag.align(2,1,1)Deletegf?Showgfag-0.40.00.40.81.21.62.02.42.8195519601965197019751980198519901995LOG(RS)-0.40.00.40.81.21.62.02.42.8-0.40.00.40.81.21.62.02.42.8195519601965197019751980198519901995LOG(RS)-0.40.00.40.81.21.62.02.42.81960197019801990LOG(RS)LOG(RS)再打开Eviews7,打开hs.wf1文件smpl1988@lastgraphgf1.linehsshowgf1gf1.datelabelformat(yyyy)interval(year,1)gf1.legend-displaycopygf1gf2showgf2gf2.datelabelformat(yyyy)interval(year,1)-spangraphgf.mergegf1gf2gf.align(2,1,1)showgf40608010012014016019881989199019911992HousingStarts40608010012014016019881989199019911992HousingStarts3.颜色和线型wfopendemosmpl1990@lastgraphgf1.linegdpm1copygf1gf2showgf2gf2.setelem(2)lcolor(orange)lwidth(2)8001,0001,2001,4001,6001,8002,0001990199119921993199419951996GDPM1copygf1gf3showgf3gf3.setelem(1)lpat(dash1)symbol(star)8001,0001,2001,4001,6001,8002,0001990199119921993199419951996GDPM1copygf3gf4showgf4gf4.options-color8001,0001,2001,4001,6001,8002,0001990199119921993199419951996GDPM1Graphgf1c.mergegf1gf2gf3gf4Gf1c.align(2,1,1)Deletegf?Smpl@allShowgf1c8001,0001,2001,4001,6001,8002,000IIIIIIIVIIIIIIIVIIIIIIIVIIIIIIIVIIIIIIIVIIIIIIIVIIIIIIIV1990199119921993199419951996GDPM18001,0001,2001,4001,6001,8002,000IIIIIIIVIIIIIIIVIIIIIIIVIIIIIIIVIIIIIIIVIIIIIIIVIIIIIIIV1990199119921993199419951996GDPM18001,0001,2001,4001,6001,8002,000IIIIIIIVIIIIIIIVIIIIIIIVIIIIIIIVIIIIIIIVIIIIIIIVIIIIIIIV1990199119921993199419951996GDPM18001,0001,2001,4001,6001,8002,000IIIIIIIVIIIIIIIVIIIIIIIVIIIIIIIVIIIIIIIVIIIIIIIVIIIIIIIV1990199119921993199419951996GDPM1也可以通过在图形上点击右键,修改图形。4.填充和纹线matrix(2,3)mmmm.fill1,5,3,4,6,2showmmfreeze(gf1)mm.barshowgf10123456712C1C2C3Copygf1gf2Gf2.options–colorshowgf2gf2.options-colorcopygf1gf3gf3.setelem(1)gray(5)hatch(7)gf3.setelem(2)gray(1)hatch(3)gf3.setelem(3)gray(3)hatch(4)copygf3gf4showgf4gf4.options-colorgraphgff.mergegf1gf2gf3gf4gff.align(2,2,2)showgff0123456712C1C2C30123456712C1C2C30123456712C1C2C30123456712C1C2C35.标注可以用addtext命令在图形中添加文字,用draw命令突出某些内容。例如graphgf1.linersshowrsclosersshowgf1copygf1gf2gf1.addtext(t)shorttreminterestrategf1.addtext(l)percentshowgf2gf2.draw(shade,bottom,rgb(235,200,180))8085gf2.draw(da
本文标题:上机实验10:Eviews作图操作
链接地址:https://www.777doc.com/doc-3485406 .html