Announcement

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

  • -graph bar-: labels and "if" statements

    Hi Statalist

    Apologies, inevitably, if this has been covered before - I've tried searching but suspect I'm not using the correct terms.

    I'm trying to draw some simple bar graphs of the frequencies of values for a particular variable A, by another variable B, while making the sizes of the labels on the x-axis tiny. I also want to do this where values of A exceed 0, as I'm using datasets where different types of missingness are coded as negative.

    However, when I specify label size using graph bar, the negative codes are included on the graph. See for example:
    sysuse auto
    graph bar if rep78>2, over(rep78)by(foreign)
    graph bar if rep78>2, over(rep78, label(labsize(tiny)))by(foreign)


    This isn't a disaster - I can recode negative values to . values, but this seems like an odd quirk.

    Does anyone have any suggestions?

  • #2
    Adding "nofill" omits empty categories. Therefore

    Code:
    graph bar if rep78>2, over(rep78, label(labsize(tiny)))by(foreign) nofill
    Last edited by Andrew Musau; 14 Jul 2016, 10:18.

    Comment

    Working...
    X