Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • x-label for two-way graphs

    I am using Stata 13.1.

    I have some graphs that I am creating. One thing I am having difficulty with is how to insert a text label (using a string variable) underneath each of the bars that the twoway command produces. The current commands work as I would expect, including sorting the graph by the variable "n", but would like to have a label underneath each. There are 56 unique bars in the graph.

    Thank you for your input.

    Donny

    Code:
    capture drop n
    capture drop trbc_prcnt
    sort trbc_centername
    gen n=_n
    graph twoway (bar trbc_centername n if region_label==1, fcolor(red) lcolor(red)) (bar trbc_centername n  if region_label==2, fcolor(blue) lcolor(blue)) (bar trbc_centername n  if region_label==4, fcolor(green) lcolor(green)) (bar trbc_centername n if region_label==5, fcolor(chocolate) lcolor(chocolate)), ylabel(0(20)100, angle(horizontal)) ytitle(Transfusions Rate) xtitle(Medical Center) title("Intra or Post-op Transfusion Rates" "by Medical Center" "AVR+/-CABG Surgery") note("Last 100 Cases Across IMPROVE Network Medical Centers") legend(off)

  • #2
    I see no xlabel() option here, so you are just getting the default. To get every bar labelled, you would need something like

    Code:
    xla(1/56, valuelabel)
    and to get those labels copied from a string variable (labmask (SJ) could help)

    and

    very short labels

    or

    very small text size

    or

    giraffe orientation

    or some combination of those. If that doesn't help you need to tell us much more about the variable n.

    Comment


    • #3
      Thank you Nick. the labmask worked. I incorporated the label with a rvertical angle and the appropriate size configuration. Much appreciated.

      Comment

      Working...
      X