Two things I need help with. I posted an image with and without the legend. You'll see that there are over 50 unique categories.
1) I need all the categories to be the same width and I would also like there to be gaps if a group doesn't have a particular category. For instance, you'll notice some companies have more NAICS codes then others, I want the companies with less NAICS codes to have gaps to better show how they compare (if they lack a NAICS code that others have, it would have a gap).
2). For some reason it looks like even though there are over 50 distinct categories the colors repeat. I'm using the default color scheme s2color and wondered why it repeats colors and if there was any way to ensure that there was a distinct color for each category. I know in theory the command I'm using (asyvars) does that but it doesn't appear to have different colors.
Here is my code below:
rename NAICSCode naics
drop if naics == "-"
destring naics, gen(NAICSCode)
egen NaicsTotal = group(NAICSCode)
egen n = group(NAICSCode)
drop if FiscalYear != 2016
#delimit ;
graph hbar NaicsTotal, over(n) over(ParentVendor) asyvars stack
title("NAICS Code", size(medium))
subtitle(, size(small))
ylabel(, grid noticks angle(horizontal))
ytitle(" ")
legend(off)
;
#delimit cr
1) I need all the categories to be the same width and I would also like there to be gaps if a group doesn't have a particular category. For instance, you'll notice some companies have more NAICS codes then others, I want the companies with less NAICS codes to have gaps to better show how they compare (if they lack a NAICS code that others have, it would have a gap).
2). For some reason it looks like even though there are over 50 distinct categories the colors repeat. I'm using the default color scheme s2color and wondered why it repeats colors and if there was any way to ensure that there was a distinct color for each category. I know in theory the command I'm using (asyvars) does that but it doesn't appear to have different colors.
Here is my code below:
rename NAICSCode naics
drop if naics == "-"
destring naics, gen(NAICSCode)
egen NaicsTotal = group(NAICSCode)
egen n = group(NAICSCode)
drop if FiscalYear != 2016
#delimit ;
graph hbar NaicsTotal, over(n) over(ParentVendor) asyvars stack
title("NAICS Code", size(medium))
subtitle(, size(small))
ylabel(, grid noticks angle(horizontal))
ytitle(" ")
legend(off)
;
#delimit cr
Comment