Announcement

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

  • Categorical variable on x axis in dot plot

    Hi,

    Super simple question sorry but I'm trying to look at mean grip strength scores across age groups and trying to convey this in a line/dot plot. Even though I'm stating the grip strength variable as the y axis variable it comes up down on the x axis. What am I not doing right? Never need to do graphs in stata so this has me a bit stuck.

    Cheers,

    Maddie

  • #2
    There is no code here to comment on: it is not even clear what command you are using, as dotplot allows you to show means.

    But, at a wild guess, what you need to know is that graph dot has an undocumented vertical option.

    I know this because once I wanted a vertical option, guessed that there might be one called vertical and found it to be true. In general, this technique is called wishful thinking and it is usually a dismal failure.

    Please see FAQ Advice:

    Section 6 on full real names please!

    Section 12 on giving fuller detail of your code, etc.

    Comment


    • #3
      My apologies Nick, the hour is late my way and I'm getting sloppy. The code I was using was:

      Code:
      graph dot (mean) avgripr, over(agecat)
      with avgripr being the average grip strength and agecat being the age category variable.

      Will try the vertical option and see how that goes!

      Thanks so much for your help!
      Attached Files

      Comment


      • #4

        Yes; vertical is what you need. There are many other ways of doing it. Below is one more. You might also consider showing more detail too, e.g. using dotplot

        Code:
        . sysuse auto
        (1978 Automobile Data)
        
        . graph dot (mean) mpg, over(rep78) vertical
        
        . collapse mpg, by(rep78)
        
        . scatter mpg rep78 , xla(1/5, grid glc(gs12) glw(vthin))

        Comment

        Working...
        X