I've been working to finalize my code for a figure, and I'm struggling to be able to see the entirety of my label on the "x" axis when using the hbar command.
When I graph as a bar plot (see file bar.jpg), everything shows up as required in the label.
Array
Here's my code:
splitvallabels question
graph bar Likert1 Likert2 Likert3 Likert4 Likert5, percentage stack over(question,label(labsize(vsmall)) relabel(`r(relabel)')) ytitle("Percent Dstribution of Likert Scores", size(vsmall)) ylabel(0(20)100,labsize(small)) bar(1, color(black) lcolor(black) lwidth(vthin)) bar(2, color(cranberry) lcolor(black) lwidth(vthin)) bar(3, color(teal) lcolor(black) lwidth(vthin)) bar(4, color(gs14) lcolor(black) lwidth(vthin)) bar(5, color(stone) lcolor(black) lwidth(vthin)) blabel(bar, size(tiny) format(%4.0f) position(center)) intensity(50) legend(size(vsmall) position(5) keygap(1) symxsize(2) label (1 "Much Less Willing") label (2 "Less Willing") label (3 "No change") label (4 "More Willing") label (5 "Much More Willing")) title("Physician Willingness to Discontinue Hourly Neuroassessments", span size (medsmall))
However, if I try to make it a horizontal bar graph (which is my preference), the left side of the figure gets truncated and I can't even read the labels (see file hbar.jpg).
Array
The code is exactly the same except for the "graph hbar".
splitvallabels question
graph hbar Likert1 Likert2 Likert3 Likert4 Likert5, percentage stack over(question,label(labsize(vsmall)) relabel(`r(relabel)')) ytitle("Percent Dstribution of Likert Scores", size(vsmall)) ylabel(0(20)100,labsize(small)) bar(1, color(black) lcolor(black) lwidth(vthin)) bar(2, color(cranberry) lcolor(black) lwidth(vthin)) bar(3, color(teal) lcolor(black) lwidth(vthin)) bar(4, color(gs14) lcolor(black) lwidth(vthin)) bar(5, color(stone) lcolor(black) lwidth(vthin)) blabel(bar, size(tiny) format(%4.0f) position(center)) intensity(50) legend(size(vsmall) position(5) keygap(1) symxsize(2) label (1 "Much Less Willing") label (2 "Less Willing") label (3 "No change") label (4 "More Willing") label (5 "Much More Willing")) title("Physician Willingness to Discontinue Hourly Neuroassessments", span size (medsmall))
It's taken me a lot of time to even get this far, and I've tried to figure it out on my own, but I've been unsuccessful. I suspect this is a simple fix, and any help is appreciated!
Related Posts with Struggling with hbar
Using label names in loop to export to excelHi, My objective is to create separate excel files for each potential value of a string variable ca…
How to match questionnaire updates with the shortest interval to a fixed date.Dear Statalist, I just want to check if this is ok or if there is a more elegant way to tidy up a m…
How to get a table that count the frequency and percentage of two variables by yearHello! I have a dataset with the following variables: Year, Symbol (to identify which firm it is), …
Two conditions for summing a variableHello. Please consider the example of my data below: Code: * Example generated by -dataex-. To ins…
How to draw a vertical graph with a list of coefficients and confident intervalToday I found a very nice way to present our result by using the vertical line with the coefficients…
Subscribe to:
Post Comments (Atom)
0 Response to Struggling with hbar
Post a Comment