Dear Stata users,
I have been trying to construct a horizontal percentage bar graph but I am having a few problems. I was able to do it in Excel, but not able to do it on Stata.
Graph 1: Total production
First, I tried plotting a total production bar graph to understand all the commands, but I wasn't able to print the title and change the blue area to a white one.
Follow the code:
Graph 2: Percent stacked bar graph
To do it, do I have to calculate the percentage of production by country or the percentage command will do it for me?
This is my data:
If anyone could help me, I appreciate it.
Thank you all,
Max
I have been trying to construct a horizontal percentage bar graph but I am having a few problems. I was able to do it in Excel, but not able to do it on Stata.
Graph 1: Total production
First, I tried plotting a total production bar graph to understand all the commands, but I wasn't able to print the title and change the blue area to a white one.
Follow the code:
Code:
graph hbar (asis) australia brazil china india russia others, over(year, sort(total) descending) stack, title("IRON ORE PRODUCTION BY COUNTRY", span pos(11)) note("Source: USGS", span) graphregion(fcolor(white) color(white)) name(ore_prod, replace
To do it, do I have to calculate the percentage of production by country or the percentage command will do it for me?
This is my data:
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input int year float(australia brazil china india russia others world) 2013 609730 386270 417287 140416 102157 534140 2190000 2014 739682 411183 410123 138000 102019 528993 2330000 2015 809882 430836 374838 142399 101049 450996 2310000 2016 858026 421358 347594 184501 101097 427424 2340000 2017 883357 425000 360000 201815 94967 464861 2430000 2018 900000 460000 335000 205000 96100 463900 2460000 2019 900000 480000 350000 210000 99000 431000 2470000 end
Thank you all,
Max
Comment