Goodmorning, I have the following dataset, I want to create a graph with a specific
I would like to create a bar graph that show contemporaneusly: tot_demand_c rec_over_tot if newgra. I wrote the following code
[/CODE]
graph bar tot_demand_c rec_over_tot if newgra <=50 , over ( Countryoforigin ,sort(1)label(nolabel))blabel(group, position (outside) orientation(vertical) size(vsmall)) graphregion(color(white)) ytitle(Total demand, size (small))
[/CODE]
However I wonder if there was a way to display the name for each bar only once and not above both variables.
Can you please help me?
Thank you for your attention
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input int Year str36 Countryoforigin float(tot_demand_c rec_over_tot newgra) 2019 "United States of America" 5 .005346221 91 2019 "Liechtenstein" 5 .005346221 91 2019 "Tajikistan" 10 .005346221 89 2019 "Paraguay" 10 .005346221 89 2019 "South Africa" 15 .010692443 87 2019 "Mexico" 15 .016038664 87 2019 "South Sudan" 20 .010692443 85 2019 "Chile" 20 .010692443 85 2019 "Cabo Verde" 22 .005346221 84 2019 "Argentina" 23 .013900176 83 2019 "Viet Nam" 25 .005346221 81 2019 "Guatemala" 25 .021384886 81 2019 "Madagascar" 35 .010692443 80 2019 "Mauritius" 36 .011761687 79 2019 "United Rep. of Tanzania" 40 .005346221 77 2019 "Burundi" 40 .005346221 77 2019 "Kazakhstan" 61 .03314657 76 2019 "Bolivia (Plurinational State of)" 63 .02459262 75 2019 "Jordan" 68 .010692443 74 2019 "Rwanda" 83 .010692443 73 2019 "Gabon" 85 .005346221 72 2019 "Dominican Rep." 92 .04170053 71 2019 "Zimbabwe" 98 .005346221 70 2019 "Belarus" 114 .031008083 69 2019 "Ecuador" 128 .02459262 68 2019 "Nicaragua" 129 .063085414 67 2019 "Uganda" 151 .016038664 66 2019 "Central African Rep." 161 .010692443 65 2019 "Yemen" 163 .016038664 64 2019 "Azerbaijan" 206 .04276977 63 2019 "Angola" 279 .005346221 62 2019 "Kyrgyzstan" 294 .14434798 61 2019 "Montenegro" 351 .005346221 60 2019 "Nepal" 382 .12189385 59 2019 "Kenya" 388 .04063128 58 2019 "Philippines" 440 .20208716 57 2019 "Honduras" 500 .380651 56 2019 "Brazil" 572 .27158803 55 2019 "Rep. of Moldova" 688 .08981652 54 2019 "Armenia" 775 .1742868 53 2019 "Cuba" 779 .2052949 52 2019 "Mauritania" 858 .032077327 51 2019 "Lebanon" 948 .06736239 50 2019 "North Macedonia" 962 .05666995 49 2019 "Benin" 1079 .12510158 48 2019 "Chad" 1125 .06201617 47 2019 "Russian Federation" 1378 .29618067 46 2019 "Peru" 1538 1.3932253 45 2019 "Dem. Rep. of the Congo" 1554 .12937856 44 2019 "Algeria" 1815 .19460246 43 2019 "Libya" 2006 .4170053 42 2019 "Colombia" 2019 .7302938 41 2019 "China" 2147 .8030024 40 2019 "Venezuela (Bolivarian Republic of)" 2190 1.6690903 39 2019 "Palestinian" 2338 .05880843 38 2019 "Niger" 2380 .27479577 37 2019 "Bosnia and Herzegovina" 2455 .07591634 36 2019 "Georgia" 2770 1.4605876 35 2019 "India" 3362 1.2809546 34 2019 "Guinea-Bissau" 3505 .6137462 33 2019 "Iran (Islamic Rep. of)" 3770 .28441897 32 2019 "Albania" 3830 1.6915444 31 2019 "Sierra Leone" 3892 .55173004 30 2019 "Ethiopia" 4386 .0844703 29 2019 "Sri Lanka" 4739 .6543775 28 2019 "Liberia" 5073 .25234166 27 2019 "Burkina Faso" 5200 .4832984 26 2019 "El Salvador" 5324 3.461144 25 2019 "Togo" 5332 .4148668 24 2019 "Syrian Arab Rep." 5495 .1646636 23 2019 "Egypt" 5584 .9772893 22 2019 "Cameroon" 5901 1.147299 21 2019 "Sudan" 6312 .25448012 20 2019 "Morocco" 8410 2.731919 19 2019 "Tunisia" 8954 .936658 18 2019 "Serbia and Kosovo: S/RES/1244 (1999)" 12537 .091955 17 2019 "Ukraine" 14079 4.284462 16 2019 "Eritrea" 18698 .25234166 15 2019 "Turkey" 18778 .647962 14 2019 "Guinea" 19014 3.2686796 13 2019 "Somalia" 21477 .7623712 12 2019 "Afghanistan" 24223 1.0767289 11 2019 "Ghana" 27416 3.0537615 10 2019 "Iraq" 27787 1.16013 9 2019 "Unknown " 29675 .6319234 8 2019 "Cote d'Ivoire" 30043 4.0075274 7 2019 "Senegal" 34656 6.072238 6 2019 "Mali" 41200 4.4929643 5 2019 "Gambia" 41284 4.701467 4 2019 "Bangladesh" 44483 8.867243 3 2019 "Pakistan" 67565 12.84804 2 2019 "Nigeria" 117634 17.823233 1 end
[/CODE]
graph bar tot_demand_c rec_over_tot if newgra <=50 , over ( Countryoforigin ,sort(1)label(nolabel))blabel(group, position (outside) orientation(vertical) size(vsmall)) graphregion(color(white)) ytitle(Total demand, size (small))
[/CODE]
However I wonder if there was a way to display the name for each bar only once and not above both variables.
Can you please help me?
Thank you for your attention
Comment