Announcement

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

  • bar with many zeros?

    Dear All, I have the following data.
    Code:
    * Example generated by -dataex-. To install: ssc install dataex
    clear
    input float(my_age r_work)
    45        0
    46        1
    47        1
    48        1
    49        1
    50        1
    51        1
    52        1
    53        1
    54        1
    55        1
    56 .8571429
    57      .75
    58     .875
    59        1
    60       .6
    61        1
    62        1
    64        1
    65        1
    66       .5
    67       .5
    68        1
    69 .6666667
    70        1
    71        1
    73        1
    80        0
    81        0
    82        0
    83        0
    85        0
    end
    My code for bar graph is
    Code:
    twoway bar r_work my_age, barw(.5) xlabel(45(5)85)
    with
    Click image for larger version

Name:	bar.png
Views:	1
Size:	25.7 KB
ID:	1475065

    My problem is that there are many zeros in the data set. How can I make them "more visible" in the above graph? Thanks.
    Ho-Chuan (River) Huang
    Stata 19.0, MP(4)

  • #2
    The bar design indeed doesn't work well -- and you can't see a difference between a value of zero and no value at all. I don't know quite what these data are or what you want to do with them, but I note gaps, as below.

    Code:
    scatter r_work my_age , ms(Oh) xli(63 72 74/79 84, lc(gs12) lw(vthin))
    Click image for larger version

Name:	river2.png
Views:	1
Size:	25.3 KB
ID:	1475091

    Comment


    • #3
      Dear Nick, Thank you for this helpful suggestion.

      Ho-Chuan (River) Huang
      Stata 19.0, MP(4)

      Comment

      Working...
      X