Announcement

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

  • Bar graph

    Stata seemingly requires all bars in bar graphs to originate at zero. What if I'd like the bars to originate at my minimum, which is less than zero? In my example below, I'd like the bars to begin at -5 and all go upward, instead of some going down and some up:

    graph bar (mean) dilma_minus_aecio, over(pref_symp, label(angle(0) labsize(vsmall) alternate tick labgap(0))) graphregion(color(white)) plotregion(lcolor(black)) ///
    blabel(bar, format(%9.2f)) bar(1, color(black)) title("D: Rousseff - Neves feeling therms") ytitle("") ytick(-5 -2.5 0 2.5 5) ylab(-5 -2.5 0 2.5 5)

    Click image for larger version

Name:	Baker graph.png
Views:	1
Size:	17.7 KB
ID:	1374125

    Last edited by Andy Baker; 13 Feb 2017, 13:48.

  • #2
    Hello Andy,

    I am a bit confused. What information are you trying to show with a bar graph of means that starts from -5?

    For example, say a bar on your bar graph starts from -5 and goes to 1. Does this bar indicate that the mean that you are trying to show is a mean of 6 or a mean of 1?

    In either case, the graph would not completely say what you want it to say. I'm not sure that a bar graph is exactly what you want.

    Could you explain more of what you are trying to show? Maybe -twoway rbar- is what you're looking for?

    Comment


    • #3
      It seems unlikely that you will be able to accomplish what you want, which does not agree with the generally understood meaning of a bar graph, for example in Wikipedia:
      A bar chart or bar graph is a chart or graph that presents grouped data with rectangle|rectangular bars with lengths proportional to the values that they represent.
      With negative numbers, typically the bar length is proportional to the absolute value of the number, and the direction from the axis captures whether the number is positive or negative.

      If what you would like is the difference between between the value for a given category, and the lowest value for any category, so the bar represents how much better than the lowest category, then I think you will have to calculate a new variable that captures that difference and then plot that variable.

      Comment


      • #4
        I join others in puzzlement here. I would extend the definition to include deviations from some reference level, which is frequently but not necessarily zero. I've seen bars start at 1 or 100% representing equality or parity, at the mean of some variable, and at freezing expressed as 32 deg F. But the empirical minimum of the data seems a stretch.

        That said, twoway bar offers this flexibility.

        Comment


        • #5
          I said "empirical minimum", but perhaps Andy wants the theoretical minimum to be the base.

          Comment


          • #6
            Thanks all.

            Comment

            Working...
            X