Announcement

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

  • two-way bar graph adjustments

    For the graph below, I would like to move the 1 on the y-axis down to where 0 is. How do I do that? Or should I switch to two way bar?

    This is what my data look like:

    var1 var2 var3 var4 var5
    1 5.25 6.14 5.62 4
    2 5.31 6.18 5.74 4.02
    3 5.52 6.3 5.9 4.36
    4 5.29 6.21 5.69 3.97
    5 5.03 6.1 5.44 3.54
    6 5.13 6.12 5.46 3.82


    I have this code: graph bar var3 var4 var5, over(var1)

    That generated this graph:

  • #2
    When I run this code (note the use of dataex to present sample data)
    Code:
    * Example generated by -dataex-. To install: ssc install dataex
    clear
    input byte var1 float(var2 var3 var4 var5)
    1 5.25 6.14 5.62    4
    2 5.31 6.18 5.74 4.02
    3 5.52  6.3  5.9 4.36
    4 5.29 6.21 5.69 3.97
    5 5.03  6.1 5.44 3.54
    6 5.13 6.12 5.46 3.82
    end
    
    graph bar var3 var4 var5, over(var1)
    I obtain the following graph. I do not understand what it is you want to change, and unfortunately the graph in post #1 does not display for me.
    Click image for larger version

Name:	bars.png
Views:	1
Size:	67.8 KB
ID:	1526086

    Comment


    • #3
      Thanks, William.

      I want to get rid of the 0 and make it start at 1 on the y-axis.

      Comment


      • #4
        Is this what you have in mind?
        Code:
        graph bar var3 var4 var5, over(var1) ylabel(1(1)6)
        Click image for larger version

Name:	bars.png
Views:	1
Size:	70.2 KB
ID:	1526096

        Comment


        • #5
          Yes, but how do I move the 1 on the y-axis down to where 0 would be?

          Comment


          • #6
            Code:
            graph bar var3 var4 var5, over(var1) ylab(1 (1) 6) exclude0

            Comment


            • #7
              The idea here will just evoke flak and/or puzzlement in most readers, more flak from experienced readers and more puzzlement from the others. If zero has meaning as a base or reference level for your variables, then bars should start at zero. If not, or you think that starting at zero is a waste of space, then use graph dot instead.

              Bar heights (or lengths) encode distance or deviation from a reference level, usually but not necessarily zero. If you don't want that principle, use another principle, encoding value by position on a numeric scale.

              Comment

              Working...
              X