Announcement

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

  • Hiding the empty categories in catplot

    Hi,

    I am making barplots using the catplot (ssc) package, to show the % diabetes by countries for different years. The plot is correct, but doesn't not very efficient as there are many empty categories, this is because for some countries there is no value for certain years.

    Here (#5) is a similar chart where I just want to hide the empty categories throughout the plot.

    Please let me know if this can be done.

    Thanks in advance!

    Code:
     sysuse auto, clear
    tab foreign rep78, row
    gen id=_n
    graph bar (count) id, over(rep78) over(foreign)
    graph bar (percent) id, over(rep78) over(foreign)  
    capture ssc inst catplot  
    catplot rep78 foreign, percent(foreign) bar(1, bfcolor(none)) blabel(bar, pos(base) format(%3.2f))

  • #2
    In each case the extra option nofill of graph bar or graph hbar will suppress the bars of zero height. That applies to catplot too.

    Comment

    Working...
    X