Announcement

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

  • graph bar: percent and count in/over bar

    Hi,

    I'm using:

    graph bar, over(x) blabel(bar, format(%2.1f) color(black) size(small) position(outside) gap(0.5))

    and I want to add counts in the bar, I know I can use graph bar (count) but I need to integrate the frequency as information inside the bar or maybe it's possible as bracket behind the percent. Is that possible?

    -Nick

  • #2
    http://www.statalist.org/forums/foru...tages-of-total has pointers.

    To keep this self-contained, here is an example cited within that thread. Your problem sounds just like a variation.

    Code:
    sysuse auto, clear
    contract rep78 if rep78 < .
    su _freq
    gen _pc = 100 * _freq / r(sum)
    gen s_pc  = string(_pc, "%2.1f") + "%"
    gen one = 1  
    twoway bar _freq rep78, barw(0.9) xla(1/5, notick) bfcolor(none) ///
    || scatter one _freq rep78, ms(none ..) mla(s_pc _freq) mlabcolor(black ..) /// mlabpos(0 12) scheme(s1color) ysc(r(0 32)) yla(, ang(h)) legend(off)
    Click image for larger version

Name:	barwithlabels.png
Views:	1
Size:	12.7 KB
ID:	1110460

    Last edited by Nick Cox; 20 Mar 2015, 10:58.

    Comment


    • #3
      Thanks, I'll try.

      Comment

      Working...
      X