Announcement

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

  • Graphics: last category on line graph not displaying

    Hello, again. On the x-axis of my line graph, I have a categorical variable with five categories. However, the data is highly skewed and no one anwered the fifth category. As a result, Stata is not displaying the fifith category on the x-axis, which I would like to display to show that no one responded. I've played around with x-axis options and other things, but can't figure out how to display the fifth category.

    This is the graph that I'm getting:


    This is the code that I'm using:

    twoway (line percentage health if dataset==0) ///
    (line percentage health if dataset==1) ///
    (line percentage health if dataset==2) ///
    (line percentage health if dataset==3)

    Any ideas for what option I might be able to use?

    Thanks in advance for your help.
    Attached Files

  • #2
    Please see the FAQ Advice, especially Section 12.
    1. Don't use photo attachments. Save graphs as .png and show them as attachments. Notice how the graphs in your last thread are easier to read when shown that way. People have to click on your photo to read it and then can't so easily look at your question at the same time.
    2. Do use CODE mark-up.
    What I get from your question is that there is a category 5 that no one used. The legend is also in need of editing. Consider
    Code:
     
      twoway line percentage health if dataset==0  ///
    || line percentage health if dataset==1 ///
    || line percentage health if dataset==2 ///
    || line percentage health if dataset==3, xla(1/5) ///
      legend(order(1 "0" 2 "1" 3 "2" 4 "3"))
    In addition, what you are calling a percentage looks more like a fraction or proportion to me.






    Comment


    • #3
      Hi Nick, okay, I'll note that for next time I post. It looks like the xla() option is the thing I was looking for... I was trying the xscale(range()) option, which wasn't working. Thanks for your help as always!

      Comment

      Working...
      X