Announcement

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

  • Recession bars not straight in graph

    Hi there,

    I am trying to graph a line graph with shaded recession bars. I have almost managed to achieve this however the bars are slightly bent. Has anyone recommendations on how to make them straight and neat?

    Many thanks

    Code:
    * Example generated by -dataex-. To install: ssc install dataex
    clear
    input int date byte recession float log_SPF double ECBInflationRate
    14304 0 2.3025851  .9
    14396 0   2.60269  .9
    14488 0  2.747271 1.2
    14579 0 2.0412204 1.7
    14670 0  4.085976   2
    end
    format %tdnn/dd/CCYY date

    Code:
    twoway (scatter recession date ,recast(area) bcolor(gs13) cmissing(n)  yaxis(9)  yscale(off)) (line log_SPF date , ylabel(0(1)10)) (line
    >  ECBInflationRate date , yaxis(2)), ylabel(0(1)4, axis(2)) graphregion(color(white)) bgcolor(white)
    Attached Files

  • #2
    They are not bent; the problem is rather that they are not vertical. There isn't enough detail in your data example to replicate the problem but presumably your recession variable flips from 0 to 1 and from 1 to 0 on successive days. Those flips define very steep lines, but not vertical lines.

    https://www.stata-journal.com/articl...article=gr0067 reviews various techniques in this territory.

    Comment


    • #3
      Hi Nick, thanks for replying to fast. Are there any free alternatives available?

      Comment


      • #4
        I'd search harder for mentions here on Statalist of recession shading. One reason I wrote a miniature review was that so many questions were being asked about it. A Google for "recession shading statalist" brought up several hits.

        Comment

        Working...
        X