我有这个数据集:
clear
input gender salary education child
1 5000 2000 2100
0 4000 2200 2300
1 4000 3220 3300
0 5660 4500 3200
1 4333 3200 2190
1 6550 4370 1990
0 4330 1900 3200
1 3500 2100 4600
1 5320 4100 3499
1 5100 2100 3100
end
下面的命令将产生以下图形:
如何将所有内容放在一张图中?
答案 0 :(得分:2)
如果您希望将所有内容都放在一张图中,那么以下方法将起作用:
graph bar salary education child, over(gender)
或者:
separate salary, by(gender)
separate education, by(gender)
separate child, by(gender)
graph bar salary? education? child?, bargap(10)
您还可以使用graph bar
的 barlook 选项来进一步调整
结果:
graph bar salary? education? child?, bargap(10) ///
bar(1, color(ebblue)) ///
bar(2, color(ebblue)) ///
bar(3, color(red)) ///
bar(4, color(red)) ///
bar(5, color(green)) ///
bar(6, color(green)) ///
legend(off)