Using the dataset shown at the bottom, I have created the following plot which is so close to what I want but with some problems as follows:
1) The label values for the x-axis are too big,
2) The label values for the y-axis do not look good,
3) The value labels on the bars do not fit in the bar and overlap,
Here is the code which I used to create the plot. Please advise how can I customize the plot.
Code:
graph bar Healthy Unhealthy Dead , over(category_num, label(angle(45))) by(gender, note("")) stack /// legend(order(1 "Healthy" 2 "Unhealthy" 3 "Dead") rows(1) size(small) region(lcolor(white))) /// ylabel(0 "0" .2 "20%" .4 "40%" .6 "60%" .8 "80%" 1 "100%", noticks nogrid angle(0) labsize(small)) /// graphregion(color(white)) /// blabel(bar, color(white) position(inside) format(%2.1f))
Nader
Array
Code:
* Example generated by -dataex-. For more info, type help dataex clear input float(gender category_num Dead Healthy Unhealthy) 0 0 4.4 73.2 22.5 0 1 3.2 75.8 21 0 2 2.4 79 18.6 0 3 2.2 77.6 20.2 0 4 2.4 71.1 26.5 0 5 2.2 81.1 16.7 0 6 2.6 76.9 20.5 0 7 3.3 71.1 25.6 0 8 1.9 78 20.1 1 0 1.9 79.3 18.8 1 1 1.5 80.4 18.1 1 2 1 83.9 15 1 3 1.1 80.7 18.2 1 4 1.3 81.5 17.2 1 5 .6 86.2 13.3 1 6 1.7 79.6 18.7 1 7 .8 78.1 21.1 1 8 1.1 82.9 16.1 end label values gender gender label def gender 0 "Male", modify label def gender 1 "Female", modify label values category_num category_num label def category_num 0 "NCG(never)", modify label def category_num 1 "NCG(<weekly)", modify label def category_num 2 "NCG(weekly+)", modify label def category_num 3 "Low-intensity CG(never)", modify label def category_num 4 "Low-intensity CG(<weekly)", modify label def category_num 5 "Low-intensity CG(weekly+)", modify label def category_num 6 "High-intensity CG(never)", modify label def category_num 7 "High-intensity CG(<weekly)", modify label def category_num 8 "High-intensity CG(weekly+)", modify
0 Response to Problem with xlabel's size
Post a Comment