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

  • How to remove variable label from x axis using catplot


    I am using Stata 15 and trying to create a simple graph using catplot. The variable I am trying to show on the graph is called "asset_built" and it has a label attached to it saying "Was the asset built at the reported worksite?" When I graph using catplot, this label comes up as text below the x axis. Is there a way I can remove this?

    My code is
    catplot asset_built, percent recast(bar) var1opts(relabel(1 "Yes, at the mentioned worksite")) title("Were assets verified built or not") blabel(bar,position(inside) color(white)) ytitle(Percentage of total assets verified) l1title("") note(Sample-`r(N)', size(medium))

    Also see attached image. I want to remove the text below the x axis.
    Click image for larger version

Name:	asset_built_bar.png
Views:	1
Size:	32.8 KB
ID:	1530882


  • #2
    catplot is from SSC, as you are asked to explain (FAQ Advice #12).

    If you are using community-contributed (also known as user-written) commands, explain that and say where they came from: the Stata Journal, SSC, or other archives. This helps (often crucially) in explaining your precise problem, and it alerts readers to commands that may be interesting or useful to them.
    The axis you refer to is called the categorical axis. That is the terminology used by official Stata for graph bar and graph hbar.

    The help for catplot gives the explanation you need:

    Note: any categorical axis title that appears by default is produced by l1title() with hbar or dot or by b1title() with bar or the (otherwise undocumented) vertical option.
    You don't give a data example I can use, but adding the option b1title("") should blank out what you don't want.


    • #3
      Thanks Nick!

      Pardon my unfamiliarity with statalist protocol - hope to get better along the way!