Dear list,
I used the excellent tabplot command by Nick Cox (from SSC) in Stata 15.1 to create a frequency plot that graphically reproduces a twoway table of frequencies. I further use the separate() option to get different coloring for the bars associated with the categories of a third variable.
The following example reproduces my code using the auto dataset (admittedly a substantively meaningless graph...):
This yields the following graph:

Now my question: Is there a way to include a legend that explains the meaning of the different bar colors as defined by separate() (in my case these are the two categories of foreign)?
Thank you very much for any suggestions and best regards,
Ulrich
I used the excellent tabplot command by Nick Cox (from SSC) in Stata 15.1 to create a frequency plot that graphically reproduces a twoway table of frequencies. I further use the separate() option to get different coloring for the bars associated with the categories of a third variable.
The following example reproduces my code using the auto dataset (admittedly a substantively meaningless graph...):
Code:
sysuse auto, clear tabplot headroom trunk, separate(foreign) bar1(bcol(gs2)) bar2(bcol(gs12))
Now my question: Is there a way to include a legend that explains the meaning of the different bar colors as defined by separate() (in my case these are the two categories of foreign)?
Thank you very much for any suggestions and best regards,
Ulrich
Comment