I am working with a dataset that contains the number of candidates for each call of a study abroad program and I prepared the following graph:
Code:
#delimit ; graph bar (asis) number_of_candidates_per_call, over(call_number, sort(1) descending label(labsize(*0.4))) nofill linetype(line) lines(lw(vthin) lc(gs12)) by(call_year, title("Number of candidates per call", placement(center))) subtitle("", nobox fcolor(none) nobexpand pos(9)) ysc(alt) horiz yla(, nogrid format(%10.0fc) labsize(*0.5)) blabel(bar, format(%9.0fc) size(*0.4)) scheme(s1color) ; #delimit cr
I would like to
(i) change the color (to red) of bars associated with a subset of four different countries: 'USA', 'UK', 'POR' and 'CAN'.
Obs: There are 21 different countries in the dataset. The variable for the acronym of the destination countries is called 'dest_country'.
(ii) place a label containing the destination country acronym just to the right of the bar only for the aforementioned subset of bars (associated with the values 'USA', 'UK', 'POR' and 'CAN' of the variable 'dest_country').
(iii) include a "title" for each panel according to the variable 'call_year' (it assumes the following values: 2011, 2012, 2013 and 2014) so that one could understand to which year each panel refers.
You can find below the code to import the dataset.
Each observation is a call and each call is linked to one country.
Can you help me with that?
Thank you very much.
Any help is greatly appreciated.
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input long call_number int call_year float number_of_candidates_per_call str3 dest_country_acronym 19 2013 180 "USA" 9 2012 141 "POR" 31 2013 119 "USA" 7 2012 101 "UK" 26 2013 98 "UK" 42 2013 90 "UK" 51 2014 88 "USA" 64 2014 73 "UK" 25 2013 60 "CAN" 2 2012 53 "USA" 32 2013 38 "GER" 22 2013 36 "HGR" 4 2012 31 "AUS" 8 2012 31 "SPN" 36 2013 31 "IRE" 59 2014 31 "CAN" 20 2013 30 "GER" 3 2012 29 "GER" 61 2014 28 "SPN" 49 2013 28 "SPN" 24 2013 25 "AUS" 56 2014 21 "AUS" 67 2014 20 "IRE" 55 2014 19 "AUS" 52 2014 19 "GER" 41 2013 16 "CAN" 33 2013 15 "FRA" 34 2013 14 "ITL" 28 2013 14 "AUS" 6 2012 14 "NL" 18 2013 13 "IRE" 23 2013 13 "CAN" 30 2013 12 "NEZ" 62 2014 11 "NL" 38 2013 11 "HGR" 54 2014 11 "ITL" 58 2014 11 "BEL" 68 2014 10 "HGR" 10 2012 10 "FRA" 48 2013 9 "NL" 27 2013 9 "CAN" 60 2014 9 "CAN" 40 2013 9 "AUS" 44 2013 7 "AUS" 43 2013 7 "CAN" 11 2012 7 "HGR" 12 2012 6 "ITL" 29 2013 5 "FIN" 57 2014 4 "BEL" 35 2013 4 "NRW" 1 2011 4 "USA" 53 2014 4 "FRA" 69 2014 2 "JPN" 50 2014 2 "POL" 17 2013 2 "CHI" 37 2013 2 "CHI" 45 2013 2 "FIN" 46 2013 2 "NEZ" 47 2013 2 "BEL" 21 2013 2 "JPN" 65 2014 1 "SWE" 39 2013 1 "JPN" 63 2014 1 "NEZ" 14 2012 1 "SWE" 5 2012 1 "SKO" 66 2014 1 "NRW" 13 2012 1 "USA" 15 2012 1 "NRW" 16 2012 1 "JPN" end label values call_number no_chamada2 label def no_chamada2 1 "101", modify label def no_chamada2 2 "117", modify label def no_chamada2 3 "118", modify label def no_chamada2 4 "119", modify label def no_chamada2 5 "121", modify label def no_chamada2 6 "122", modify label def no_chamada2 7 "123", modify label def no_chamada2 8 "126", modify label def no_chamada2 9 "127", modify label def no_chamada2 10 "128", modify label def no_chamada2 11 "129", modify label def no_chamada2 12 "130", modify label def no_chamada2 13 "132", modify label def no_chamada2 14 "133", modify label def no_chamada2 15 "134", modify label def no_chamada2 16 "135", modify label def no_chamada2 17 "136", modify label def no_chamada2 18 "138", modify label def no_chamada2 19 "143", modify label def no_chamada2 20 "144", modify label def no_chamada2 21 "145", modify label def no_chamada2 22 "146", modify label def no_chamada2 23 "147", modify label def no_chamada2 24 "148", modify label def no_chamada2 25 "149", modify label def no_chamada2 26 "151", modify label def no_chamada2 27 "152", modify label def no_chamada2 28 "153", modify label def no_chamada2 29 "154", modify label def no_chamada2 30 "155", modify label def no_chamada2 31 "156", modify label def no_chamada2 32 "157", modify label def no_chamada2 33 "158", modify label def no_chamada2 34 "159", modify label def no_chamada2 35 "161", modify label def no_chamada2 36 "162", modify label def no_chamada2 37 "163", modify label def no_chamada2 38 "164", modify label def no_chamada2 39 "165", modify label def no_chamada2 40 "167", modify label def no_chamada2 41 "168", modify label def no_chamada2 42 "170", modify label def no_chamada2 43 "171", modify label def no_chamada2 44 "172", modify label def no_chamada2 45 "173", modify label def no_chamada2 46 "174", modify label def no_chamada2 47 "176", modify label def no_chamada2 48 "177", modify label def no_chamada2 49 "178", modify label def no_chamada2 50 "179", modify label def no_chamada2 51 "180", modify label def no_chamada2 52 "181", modify label def no_chamada2 53 "182", modify label def no_chamada2 54 "183", modify label def no_chamada2 55 "184", modify label def no_chamada2 56 "185", modify label def no_chamada2 57 "186", modify label def no_chamada2 58 "187", modify label def no_chamada2 59 "188", modify label def no_chamada2 60 "189", modify label def no_chamada2 61 "191", modify label def no_chamada2 62 "193", modify label def no_chamada2 63 "194", modify label def no_chamada2 64 "195", modify label def no_chamada2 65 "197", modify label def no_chamada2 66 "198", modify label def no_chamada2 67 "199", modify label def no_chamada2 68 "201", modify label def no_chamada2 69 "202", modify
0 Response to How to change the look of a subset of bars using specific criteria - bar graphs
Post a Comment