Hi All,
I am interested in displaying a bar chart by decile cut-offs, and so would like each tick mark to appear to the right of each bar. So for example in the graph attached, it would be clear that the first bar on the left corresponds to the bin from 0 to 2020. I do not want to simply relabel each of these values by their range (0-2020 etc.), as I will have to run these graphs by group and it will be too cluttered for display. My efforts exploring tick-placement options haven't been fruitful - anyone have any idea how to do this? For example, suppose I was interested in displaying the mean car price by weight decile:
sysuse auto, clear
xtile psize = weight, nquantiles(10)
_pctile weight, nq(10)
gen psizelab = .
forvalues x = 1(1)9 {
replace psizelab = r(r`x') if psize == `x'
}
quietly: summ weight, d
replace psizelab = r(p99) if psize == 10
collapse (mean) price (first) psizelab, by(psize)
labmask psize, values(psizelab)
graph twoway bar price psize, xlabel(1 2 3 4 5 6 7 8 9 10, valuelabel)
Is there a way to alter the bar chart style or tick option such that the ticks are placed to the right of each bar? Thanks!
I am interested in displaying a bar chart by decile cut-offs, and so would like each tick mark to appear to the right of each bar. So for example in the graph attached, it would be clear that the first bar on the left corresponds to the bin from 0 to 2020. I do not want to simply relabel each of these values by their range (0-2020 etc.), as I will have to run these graphs by group and it will be too cluttered for display. My efforts exploring tick-placement options haven't been fruitful - anyone have any idea how to do this? For example, suppose I was interested in displaying the mean car price by weight decile:
sysuse auto, clear
xtile psize = weight, nquantiles(10)
_pctile weight, nq(10)
gen psizelab = .
forvalues x = 1(1)9 {
replace psizelab = r(r`x') if psize == `x'
}
quietly: summ weight, d
replace psizelab = r(p99) if psize == 10
collapse (mean) price (first) psizelab, by(psize)
labmask psize, values(psizelab)
graph twoway bar price psize, xlabel(1 2 3 4 5 6 7 8 9 10, valuelabel)
Is there a way to alter the bar chart style or tick option such that the ticks are placed to the right of each bar? Thanks!
Comment