Hi everyone,

I am using catplot from SSC in Stata 17 on Windows. I am using the following code to create a stacked barplot over several variables:

Code:
*Stacked bar plot of all antibiotic variables
local i =1
local ll " yscale(off)"
foreach v of var ampiamox penicillin streptomycin tetracycline cephalexin cotrimoxazole augmentin doxycycline erythromycin ciprofloxacin colistin {
if `i'==11 loc ll "ylab(0(10)100)"
catplot `v', percent stack asyvars name(g`i', replace) ytit("") blabel(bar, pos(center) format(%2.1f) size(small)) var1opts(label(ang(45))) legend(cols(3) size(tiny))  `ll'
local `++i'
}

*Combine graphs with single legend
grc1leg g1 g2 g3 g4 g5 g6 g7 g8 g9 g10 g11, cols(1) imargin(zero) ycommon xcommon legendfrom(g1) ysize(7) xsize(7)

The figure looks as below (sorry I can't get a good size, medium is too small and large is too large). I would like to rotate the category axis labels so that they are horizontal. Many of the examples I have seen on Statalist seem to do that automatically, so I'm not sure why this is not happening. I added
Code:
var1opts(label(ang(45)))
to try and do this, but it doesn't do anything. I would also like to reverse the yscale so that "mentioned spontaneously" appears on the left of the plot and "don't know on the right. Is this possible? Or are there other plot types that could be used to do something like this?

Thanks,

Sonia


Array