I am trying to place my legend at the bottom of my graph when I am plotting two variables in my xtset data. Using help legend, I have read on the position(clockposstyle), but I can not get the legend to show up at position(6). Instead it always stays at position(3). MRE:
Crossposted from StackOverflow.
Code:
* Clearing existing data and setting up clear set obs 64 * Creating the panel identifiers gen country_id = ceil(_n/4) gen year = 2001 + mod(_n-1, 4) + 1 * Labelling countries for readability label define country_label 1 "Country01" 2 "Country02" 3 "Country03" 4 "Country04" 5 "Country05" 6 "Country06" 7 "Country07" 8 "Country08" 9 "Country09" 10 "Country10" 11 "Country11" 12 "Country12" 13 "Country13" 14 "Country14" 15 "Country15" 16 "Country16" label values country_id country_label * Setting up the panel data structure xtset country_id year * Generating random variables x and y set seed 0 gen x = rnormal() gen y = rnormal() * Display the first 20 observations list country_id year x y in 1/20, sepby(country_id) xtline x y, legend(position(6))
Comment