Hi Statalist,
I am trying to make six bar charts summarizing data from a review. Some of the graphs have many bars and some have fewer, but I would like all the graphs to look similar by giving them the same bar-width. However, as I understand it is not possible to set bar-width using the graph hbar command. I have tried to change the size of the graph window, which helps a bit, but not completely.
The first graph is created like this:
graph hbar AAbw, ///
over (MeanP501) bar(1, color(black)) bar(2, color(gs8)) ///
over(study, label(labsize(tiny))) ///
over(country, label(labsize(vsmall)) gap(400)) nofill ///
ytitle("Acrylamide (μg/kg bw/day)", size(vsmall)) ///
ysize(8) ///
xsize(5) ///
ylabel(0(0.1)0.9, labsize(vsmall)) ///
legend(size(vsmall)) ///
graphregion(color(white))
And looks like this

While another graph is created like this:
graph hbar AAday, ///
over (MeanP502) bar(1, color(black)) bar(2, color(gs8)) ///
over(study, label(labsize(tiny))) ///
over(country, label(labsize(vsmall)) gap(400)) nofill ///
ytitle("Acrylamide (μg/day)", size(vsmall)) ///
ysize(5) ///
xsize(5) ///
ylabel(0(5)30, labsize(vsmall)) ///
legend(size(vsmall)) ///
graphregion(color(white))
And looks like this:

I have tried to make the bars in the second graph thinner by reducing the height of the graph:
graph hbar AAday, ///
over (MeanP502) bar(1, color(black)) bar(2, color(gs8)) ///
over(study, label(labsize(tiny))) ///
over(country, label(labsize(vsmall)) gap(400)) nofill ///
ytitle("Acrylamide (μg/day)", size(vsmall)) ///
ysize(3) ///
xsize(5) ///
ylabel(0(5)30, labsize(vsmall)) ///
legend(size(vsmall)) ///
graphregion(color(white))
But that just makes the space used for the y-axis text smaller (and preferably I would like that space to be similar in all the graphs):

Is there any way for me to control the bar-width in these graphs?
Thank you in advance,
Amalie
I am trying to make six bar charts summarizing data from a review. Some of the graphs have many bars and some have fewer, but I would like all the graphs to look similar by giving them the same bar-width. However, as I understand it is not possible to set bar-width using the graph hbar command. I have tried to change the size of the graph window, which helps a bit, but not completely.
The first graph is created like this:
graph hbar AAbw, ///
over (MeanP501) bar(1, color(black)) bar(2, color(gs8)) ///
over(study, label(labsize(tiny))) ///
over(country, label(labsize(vsmall)) gap(400)) nofill ///
ytitle("Acrylamide (μg/kg bw/day)", size(vsmall)) ///
ysize(8) ///
xsize(5) ///
ylabel(0(0.1)0.9, labsize(vsmall)) ///
legend(size(vsmall)) ///
graphregion(color(white))
And looks like this
While another graph is created like this:
graph hbar AAday, ///
over (MeanP502) bar(1, color(black)) bar(2, color(gs8)) ///
over(study, label(labsize(tiny))) ///
over(country, label(labsize(vsmall)) gap(400)) nofill ///
ytitle("Acrylamide (μg/day)", size(vsmall)) ///
ysize(5) ///
xsize(5) ///
ylabel(0(5)30, labsize(vsmall)) ///
legend(size(vsmall)) ///
graphregion(color(white))
And looks like this:
I have tried to make the bars in the second graph thinner by reducing the height of the graph:
graph hbar AAday, ///
over (MeanP502) bar(1, color(black)) bar(2, color(gs8)) ///
over(study, label(labsize(tiny))) ///
over(country, label(labsize(vsmall)) gap(400)) nofill ///
ytitle("Acrylamide (μg/day)", size(vsmall)) ///
ysize(3) ///
xsize(5) ///
ylabel(0(5)30, labsize(vsmall)) ///
legend(size(vsmall)) ///
graphregion(color(white))
But that just makes the space used for the y-axis text smaller (and preferably I would like that space to be similar in all the graphs):
Is there any way for me to control the bar-width in these graphs?
Thank you in advance,
Amalie
Comment