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

  • Creating Bar Graph with Line

    Dear all,

    I was wondering if there is someone who can help me with regards to my bar graph.
    With the following code I created the graph shown below:

    graph bar (sum) PSPP CSPP CBPP3 ABSPP, over (Date_APP_M, label(angle (90) labsize(small)) relabel(1"Mar"2" "3" "4"Jun"5" "6" "7"Sep"8" "9" "10"Dec"11" "12" "13"Mar"14" "15" "16"Jun"17" "18" "19"Sep"20" "20" "22"Dec"23" "24" "25"Mar"26" "27" "28"Jun"29" "30" "31"Sep"32" "33" "34"Dec"35" "36" "37"Mar"38" "39" "40"Jun"41" "42" "43"Sep"44" "45" "46"Dec"47" "48" ")) ///
    stack over (Date_APP_Y) ///
    ylabel(, angle(0) labsize(small)) ///
    ytitle("EUR (billions)") ///
    note ("Source: History of APP redemptions, ECB website", size(vsmall)) ///
    legend(label(1 "PSPP") label(2 "CSPP") label(3 "CBPP3") label(4 "ABSPP"))
    Now I am stuck with two questions:

    (1) Can I add a line variable that shows the average monthly purchases of these four programs? I know I can add a straight line, but the line I want to add changes its value over time (from 60 to 80 back to 60, to 30, to 15). As far as I know (and I just started using stata, so I might be wrong), I can only add bars and lines in one graph with two-way. But as I am using groups, I cannot use a two-way graph?

    (2) How I can reposition the labels of the x-axis? As it is now, the months under the bars don't correspond with the value of bar. As the first bar shown is supposed to be March, but now this is not the case.

    Thank you for taking the time to read this.

    Attached Files
    Last edited by Lisanne Oo; 23 Jun 2019, 13:09.

  • #2
    Anyone who can help me with question (1)?