Dear all,
I want add a stacked bar chart and a line chart together. However, since the percentage values of the variables in the stack bar are close, it hides one variable and can't display in the barchart (hh consumption annual change- is not visible).
I put my code below. can you please help me in fixing my code. I want to replicate the graph attached below
stata code:
tsset time
graph twoway ///
(bar cons_gr time, pstyle(p4bar) barwidth(0.6)) ///
(bar gov_spend_gr time, pstyle(p3bar) barwidth(0.6)) ///
(bar gross_capital_formation_gr time, pstyle(p2bar) barwidth(0.6)) ///
(bar net_export_gr time, pstyle(p1bar) barwidth(0.6)) ///
(line gdp_gr time, pstyle(p6dot))
I want add a stacked bar chart and a line chart together. However, since the percentage values of the variables in the stack bar are close, it hides one variable and can't display in the barchart (hh consumption annual change- is not visible).
I put my code below. can you please help me in fixing my code. I want to replicate the graph attached below
stata code:
tsset time
graph twoway ///
(bar cons_gr time, pstyle(p4bar) barwidth(0.6)) ///
(bar gov_spend_gr time, pstyle(p3bar) barwidth(0.6)) ///
(bar gross_capital_formation_gr time, pstyle(p2bar) barwidth(0.6)) ///
(bar net_export_gr time, pstyle(p1bar) barwidth(0.6)) ///
(line gdp_gr time, pstyle(p6dot))
Code:
* Example generated by -dataex-. For more info, type help dataex clear input int time float(gross_capital_formation_gr gov_spend_gr cons_gr net_export_gr gdp_gr) 2000 . . . . . 2001 -4.57481 2.1087377 1.0260786 1.0260786 1.875098 2002 .3454278 1.3808725 1.6651844 1.6651844 2.9992554 2003 3.6846826 .59398466 -.5998673 -.5998673 1.806385 2004 4.4764614 -2.406074 -1.7193335 -1.7193335 3.092364 2005 5.841976 -1.7591026 -.7534954 -.7534954 3.2104545 2006 4.258789 .9061334 .2080552 .2080552 2.637944 2007 1.3221928 .009202804 .568028 .568028 2.0499046 2008 .6885871 2.4357965 -.4875244 -.4875244 .9954063 2009 -8.777685 11.385446 5.713411 5.713411 -2.915086 2010 6.933267 -2.2268941 -.997973 -.997973 3.0908065 2011 2.8509014 -1.5347315 -1.922189 -1.922189 3.1371944 2012 2.964998 -.4162595 .2103034 .2103034 1.7556614 2013 .16138093 -1.678759 -.10612205 -.10612205 2.3258135 2014 -.14841795 -2.1144104 -.29404652 -.29404652 2.873467 2015 -4.2182727 3.016126 3.6071465 3.6071465 .649971 2016 -4.4517307 .8152912 1.1682287 1.1682287 1.038551 2017 3.467971 -1.637724 -.8687419 -.8687419 3.033835 2018 -.7352638 -.10577374 -.15402387 -.15402387 2.742963 2019 -1.43253 -.08672807 -.22868852 -.22868852 1.908432 2020 -1.5957807 9.860924 -1.6115885 -1.6115885 -5.038233 2021 7.231438 -5.544974 -4.586067 -4.586067 5.286957 2022 4.3162904 -3.5007775 -.7903162 -.7903162 3.8198664 2023 -5.298913 2.488734 2.5555406 2.5555406 1.2489274 end
Comment