Hi Statalist
I use Stata 14.1 on MacOS. I'm stuck with a (probably) simple thing.
A sample of my dataset can be obtained using the following code:
I want to graph (using graph box) a continuous variable according to two categorical variables. My final goal is to get a graph box like this: large box gap between categories and adjusting colour across the second category.
But, when I use two over() categories, I get gaps as I want but I cannot figure out how to personalize colours of boxes 2,4 and 6.

And when I use one combining variable as follows
, I'm not able to adjust two different gaps:

As shown in the first graph (done with Graph Editor), I guess it's possible using code but I did not figure out how to do that...
Any idea?
Thank you very much
I use Stata 14.1 on MacOS. I'm stuck with a (probably) simple thing.
A sample of my dataset can be obtained using the following code:
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input float std_PHYS byte insee float(id_controle class) 50.6022 0 1 2 55.27794 1 1 1 57.39201 1 1 1 33.684685 1 1 1 47.8986 1 1 1 26.17278 1 1 1 48.88623 1 1 1 48.38394 1 1 1 54.13319 1 1 1 47.31923 1 1 1 23.920927 1 1 1 44.27946 1 1 1 55.44976 1 1 1 42.15575 1 1 1 51.50533 1 1 1 55.01159 1 1 1 55.18439 0 2 4 65.090256 1 2 3 56.41214 1 2 3 23.55465 1 3 5 end
I want to graph (using graph box) a continuous variable according to two categorical variables. My final goal is to get a graph box like this: large box gap between categories and adjusting colour across the second category.
But, when I use two over() categories, I get gaps as I want but I cannot figure out how to personalize colours of boxes 2,4 and 6.
Code:
graph box std_PHYS, over(insee) over(id_controle) asyvar
And when I use one combining variable as follows
Code:
graph box std_PHYS, over(class) asyvar box(1, color(red)) box(2, color(navy)) box(3, color(red)) box(5, color(red)) box(4, color(blue)) box(6, color(green))
As shown in the first graph (done with Graph Editor), I guess it's possible using code but I did not figure out how to do that...
Any idea?
Thank you very much
Comment