Announcement

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

  • Scatter plot with two different background colors

    Hello! I'm representing graphically the evolution of my variable (total entries of people in a program; "total") quarterly using a scatter plot. The thing is that I would like to change the background colour of only one part of my graphic, to highlight the values of the two last quarters. I read several manuals and I look for that in the forum but I really do not find the way. The closest way that I tried is this one, but I am not convinced, it's not really what I have in mind.

    scatter total quarter || lfit total quarter, plotregion(fcolor(ebg) margin (l+10 r-10)) graphregion(margin(l+10 r+20))

  • #2
    Hi, Gin.
    I typically use xlines. Example:

    Code:
    clear
    set obs 100
    gene x = runiform()
    gene y = runiform()
    scatter x y, xline(0(0.001)0.5, lcolor(yellow*0.30)) xline(0.5(0.001)1, lcolor(dkgreen*0.30))

    Comment


    • #3
      https://www.stata-journal.com/articl...article=gr0067 discusses possibilities in a fairly systematic way.

      Comment


      • #4
        Thank you to both!

        Comment

        Working...
        X