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
Changing date format in Stata graphsHello, I have daily data from jan 2004 to sep 2017 and I want to have on the x-axis the dates showi…
Best way to write "input files" at top of .do file (macros?)I am interested in listing all of my "input" and "output" files early in my code so that the list is…
re-transformation of logged DV give ridiculous valueDear All, I have a quick question. I am not sure what I did wrong here. After I run ivregress 2sls,…
Delimit Propensity Score to obtain a better matchingHello, I have a general doubt about PSM. The analyses of the graph (using teffects psmatch) are muc…
Saving multiple file names in one .txt or .dat Dear all, I would like to run Monte Carlo simulation in Mplus using 100 data generated from Stata. …
Subscribe to:
Post Comments (Atom)
0 Response to Struggling with hbar
Post a Comment