Dear Statalisters,
I have a query that I am fairly certain will result in advice to go back to two-way graph to make a bespoke solution, but just in case I am missing something obvious.
I am plotting a number of events occurring in different categories. The events have different severities and I have elected to use a stacked bar chart to demonstrate this as the total number of comparative events is important to visualise at the same time as the breakdown (acknowledging the advantages that tabplot can have in these scenarios).
I am plotting percentages, but would like to label each of the stacked sections of bar chart with the frequencies of occurrence (not percentages), as when comparing this to a separate and much smaller population, it is worth highlighting this, however, as far as I understand it, this is not possible and using blabel will give me only the percentages if plotting percentages, and frequencies if plotting frequencies.
Of note, I have included allcategories to ensure that columns which have no data are also included, and, as a result I have also had to specify legend order in order to make sure that the base value of severity (=0) is not displayed, as I believe that all categories also forces this.
Any advice that could be provided would be appreciated
Many thanks
Rob
I have a query that I am fairly certain will result in advice to go back to two-way graph to make a bespoke solution, but just in case I am missing something obvious.
I am plotting a number of events occurring in different categories. The events have different severities and I have elected to use a stacked bar chart to demonstrate this as the total number of comparative events is important to visualise at the same time as the breakdown (acknowledging the advantages that tabplot can have in these scenarios).
I am plotting percentages, but would like to label each of the stacked sections of bar chart with the frequencies of occurrence (not percentages), as when comparing this to a separate and much smaller population, it is worth highlighting this, however, as far as I understand it, this is not possible and using blabel will give me only the percentages if plotting percentages, and frequencies if plotting frequencies.
Of note, I have included allcategories to ensure that columns which have no data are also included, and, as a result I have also had to specify legend order in order to make sure that the base value of severity (=0) is not displayed, as I believe that all categories also forces this.
Any advice that could be provided would be appreciated
Many thanks
Rob
Code:
foreach var of local systemic { colorpalette red yellow, ipolate(4) nograph catplot Overall_`var' if Overall_`var'!=0 & Diary==1, over(Armcode) stack asyvars bar(2, col("`r(p4)'")) bar(3, col("`r(p3)'")) bar(4, col("`r(p2)'")) bar(5, col("`r(p1)'")) percent graphregion(color(white)) bgcolor(white) allcategories legend(order(2 3 4)) blabel(bar)
Comment