Code:
sysuse auto, clear gen himpg = mpg > 25 label def himpg 1 "mpg > 25" 0 "mpg <= 25" label val himpg himpg catplot himpg rep78 foreign
Next, following the help file instructions, I reduce the gap between the second category to demonstrate how the gap is set, using the option var2opts (for the second variable rep78):
Code:
catplot himpg rep78 foreign , var2opts(gap(0))
Clearly, the gap between the categories of rep78, with separate bars as defined by himpg, is reduced to zero.
Now I want to increase the (zero) gap of the separate bars as defined by himpg, using:
Code:
catplot himpg rep78 foreign , var1opts(gap(*.2))
To me it looks as if var1opts(gap(*.2)), nor something like var1opts(gap(2)), is processed.
Maybe I misread the help file, or some other syntax is required, but possibly there is an error in de ado file.
In any case, it would be really useful to be able to control the gap between sub-category bars (when 3 variables are used).
This, actually, is possible with 2 variables, like:
Code:
catplot himpg rep78 , var1opts(gap(*.2)) var2opts(gap(*.5))
But then, I am not able to change the colors of the bars between the two categories of himpg.
(Dear Nick, could you comment on my issues?)
0 Response to catplot - how to control the gap between bars when 3 variables are used
Post a Comment