Announcement

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

  • Different blue color in twoway chart than the marginsplot

    The marginsplot generates the following chart:

    sysuse auto, clear
    logistic foreign mpg price rep78
    margins , at(rep78=(1(1)5))
    marginsplot

    Click image for larger version

Name:	ex1.png
Views:	1
Size:	36.3 KB
ID:	1772174

    However the blue color of the following plot is different:

    collapse (mean) price , by(rep78)
    twoway line price rep78 , lcolor(blue)

    Click image for larger version

Name:	ex2.png
Views:	1
Size:	34.1 KB
ID:	1772175


    Is there a way to make the blue color in the twoway similar to the first one coming from Stata's default for marginsplot, so that I can present all my charts in the same blue color?


  • #2
    Stata uses a colour it terms stblue as the blue for the default stcolor scheme in Stata 18. You can see this mentioned in
    Code:
    help colorstyle
    You can check what this colour is in terms of RGB by doing:
    Code:
    . palette color stblue
    ("stblue" = "26    133    255"%100)

    Comment


    • #3
      The line colour in #1 (coming from Stata 18) is stc1.

      For more detail, see e.g. https://www.statalist.org/forums/for...scheme-stcolor

      Comment


      • #4
        Just a quick note to add that there is no conflict between #2 and #3. stc1 and stblue are synonymous.

        Code:
        . palette color stc1 stblue
        ("stc1" = "26    133    255"%100, "stblue" = "26    133    255"%100)

        Comment

        Working...
        X