Hello,
I have health expenditure data for 20 countries covering 1971-2019 which looks like below. I also calculated a Fourier function to see how good the Fourier function fits the data for each country.
Code:
* Example generated by -dataex-. For more info, type help dataex clear input float year long country float id double health float fourier 1971 1 1 -.048536042892761824 -.03952992 1972 1 1 -.08843363377541565 -.04224652 1973 1 1 -.092863008288085 -.04566855 1974 1 1 -.04994182142543355 -.04974203 1975 1 1 -.0123082348645286 -.05440232 1976 1 1 -.02792827260278471 -.05957511 1977 1 1 -.025661616531818306 -.06517772 1978 1 1 -.07116244745290785 -.07112036 1979 1 1 -.09433644681980902 -.0773077 1980 1 1 -.09588154779403167 -.08364037 1981 1 1 -.07324787825170909 -.0900166 1982 1 1 -.09699708181124123 -.09633397 1983 1 1 -.09129861506032695 -.10249094 1984 1 1 -.07801576288065505 -.10838865 1985 1 1 -.08787130215726849 -.1139325 1986 1 1 -.10368869339759779 -.11903369 1987 1 1 -.12984473701132185 -.12361068 1988 1 1 -.13601273697759464 -.12759055 1989 1 1 -.13522305909266027 -.1309102 1990 1 1 -.16410929161392002 -.13351732 1991 1 1 -.1749034081219039 -.13537136 1992 1 1 -.17267929170185997 -.13644409 1993 1 1 -.15660589634579344 -.13672014 1994 1 1 -.14090811627074754 -.1361972 1995 1 1 -.1284335655668775 -.13488609 1996 1 1 -.11190290870963263 -.13281055 1997 1 1 -.11524180552098832 -.13000692 1998 1 1 -.11115354361157273 -.12652346 1999 1 1 -.1129532612256796 -.1224196 2000 1 1 -.10835246407053643 -.11776494 2001 1 1 -.11400252493988818 -.11263816 2002 1 1 -.11788591728754902 -.10712566 2003 1 1 -.11254442813587473 -.1013202 2004 1 1 -.08363546588831329 -.0953193 2005 1 1 -.09284501401780126 -.08922377 2006 1 1 -.07979523121839557 -.0831359 2007 1 1 -.06995821404301965 -.07715791 2008 1 1 -.05752852459211174 -.07139017 2009 1 1 -.07075001456909177 -.065929614 2010 1 1 -.04969200603502319 -.06086815 2011 1 1 -.03984778668039857 -.0562911 2012 1 1 -.05154969019569319 -.05227587 2013 1 1 -.0497840265353243 -.0488906 2014 1 1 -.048793576715315486 -.04619313 2015 1 1 -.04948574453129099 -.04422996 2016 1 1 -.047359177099794286 -.04303557 2017 1 1 -.044218573712996125 -.0426318 2018 1 1 -.051062423551047474 -.04302751 2019 1 1 -.06104803674991116 -.04421844 1971 2 2 -.052224026069246726 .04733511 1972 2 2 -.05553294294401772 .04135935 1973 2 2 -.03474559274618068 .03687684 1974 2 2 -.0182180229388336 .033952687 1975 2 2 .13326770223542225 .03262639 1976 2 2 .16351073041347156 .03291123 1977 2 2 .16362296723203298 .034794025 1978 2 2 .16296694361277436 .03823534 1979 2 2 .18836892476247213 .04317018 1980 2 2 .19872515475682395 .049509 1981 2 2 .02624677561653282 .05713921 1982 2 2 .013270242662924406 .065927014 1983 2 2 -.007179835216951704 .07571962 1984 2 2 -.008342505302864376 .08634771 1985 2 2 -.007111580631541289 .09762829 1986 2 2 -.008340801048958653 .1093676 1987 2 2 .0135341918959422 .1213644 1988 2 2 -.0013931907919246195 .13341318 1989 2 2 .03495434943710156 .1453076 1990 2 2 .18795793711315376 .15684384 1991 2 2 .18789604274914862 .167824 1992 2 2 .20764800747810722 .1780592 1993 2 2 .25366938276007367 .187373 1994 2 2 .2984252024669359 .19560385 1995 2 2 .2890248838655149 .20260814 1996 2 2 .27253282714672866 .20826234 1997 2 2 .2654448894076852 .2124651 1998 2 2 .26901558010899657 .21513894 1999 2 2 .26938020863676154 .2162314 2000 2 2 .24211126692168153 .2157161 2001 2 2 .20775990079827972 .21359293 2002 2 2 .18572497089675324 .20988826 2003 2 2 .1631756520898294 .20465444 2004 2 2 .1665089246092707 .1979689 2005 2 2 .14807873089046864 .18993287 2006 2 2 .1416541922510765 .18066983 2007 2 2 .14415632984664126 .1703234 2008 2 2 .14638311927339548 .1590549 2009 2 2 .13329847280662777 .14704087 2010 2 2 .13033381207252606 .1344701 2011 2 2 .10474485404573974 .1215405 2012 2 2 .11025954819939078 .10845583 2013 2 2 .10129144374916023 .09542245 2014 2 2 .0931375767153433 .08264589 2015 2 2 .07071030201701785 .070327386 2016 2 2 .0581133122787421 .05866073 2017 2 2 .05343910999252845 .04782898 2018 2 2 .04770897486693318 .03800148 2019 2 2 .04395661815196764 .0293311 1971 3 3 -.16552630479892813 -.0653828 1972 3 3 -.14708090543709273 -.05491805 end
Code:
forvalues i=1(1)20{ xtline health fourier if id==`i', name(g`i', replace) xtitle("") ylabel(,angle(0)) xlabel( 1971 1980 1990 2000 2010 2019, angle(90)) legend(off) } gr combine g1 g2 g3 g4 g5 g6 g7 g8 g9 g10 g11 g12 g13 g14 g15 g16 g17 g18 g19 g20 ,name(Fourier_1, replace)
Why do I have the legend? What am I missing? I also wonder why some graphs (i.e., Australia, Ireland and New Zealand) are smaller compared to the others. Many thanks in advance.
Array
0 Response to Graph legend(off) does not work
Post a Comment