Announcement

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

  • list colors used in color scheme

    Hi there

    Anyone know if there is a way of listing the colors used in a color scheme, ordered by first, second, third preference, etc?

  • #2
    Or, to ask a slightly different question, how to find out the names of the line colors used in a line graph?

    Comment


    • #3
      I don't know a method better than to look for all lines in a scheme file starting with color.

      In practice, many, I guess, most schemes are defined by overwriting some of the settings of s2color. So, you need when that is true to look at two scheme files at least.

      Comment


      • #4
        Thanks Nick, for your reply.
        That's a shame because sometimes you might like the look of a color but want to re-order it.

        Comment


        • #5
          palettes from SSC can show you this. As Nick notes, the selection depends on your scheme.

          Code:
          ssc install palettes, replace
          colorpalette, lc(black): s2 / s1 / s1r / economist / mono
          Res.:
          Click image for larger version

Name:	Graph.png
Views:	1
Size:	21.6 KB
ID:	1724356

          Comment


          • #6
            I sometimes open up the Graph Editor to find which colour was used for a particular graph element.

            Comment


            • #7
              I've just come across this thread whilst searching for similar info.
              In case it's of interest to others, in Stata 18 you can now refer to scheme colours specifically, rather than just the overall style. That is: mcolor(stc1) means "give my marker the colour from within style p1". Put another way: stc1, ..., stc15 are now permissible colour names for twoway in the same way as "blue", "green", etc. This is documented under help colorstyle. I've found this really helpful when coding, because you can parse style-specific colour options without worrying about the styles themselves.

              Comment


              • #8
                maybe:
                Code:
                * schemes white_ptol gg_hue from https://github.com/asjadnaqvi/stata-schemepack
                
                foreach scheme in white_ptol gg_hue economist {
                    
                    set scheme `scheme'
                
                    gr_setscheme
                
                    forvalues i = 1/15 {
                        
                        local p`i' `.__SCHEME.color.p`i''
                
                        di "`scheme' p`i': `p`i''"
                    }
                    
                    di _n 
                }
                scheme-white_ptol.scheme
                gg_hue.scheme
                Code:
                white_ptol p1: 51 34 136
                white_ptol p2: 102 153 204
                white_ptol p3: 136 204 238
                white_ptol p4: 68 170 153
                white_ptol p5: 17 119 51
                white_ptol p6: 153 153 51
                white_ptol p7: 221 204 119
                white_ptol p8: 102 17 0
                white_ptol p9: 204 102 119
                white_ptol p10: 170 68 102
                white_ptol p11: 136 34 85
                white_ptol p12: 170 68 153
                white_ptol p13: 51 34 136
                white_ptol p14: 102 153 204
                white_ptol p15: 136 204 238
                
                
                gg_hue p1: 248 118 109
                gg_hue p2: 229 135 0
                gg_hue p3: 201 152 0
                gg_hue p4: 163 165 0
                gg_hue p5: 107 177 0
                gg_hue p6: 0 186 56
                gg_hue p7: 0 191 125
                gg_hue p8: 0 192 175
                gg_hue p9: 0 188 216
                gg_hue p10: 0 176 246
                gg_hue p11: 97 156 255
                gg_hue p12: 185 131 255
                gg_hue p13: 231 107 243
                gg_hue p14: 253 97 209
                gg_hue p15: 255 103 164
                
                
                economist p1: edkblue
                economist p2: emidblue
                economist p3: eltblue
                economist p4: emerald
                economist p5: erose
                economist p6: ebblue
                economist p7: eltgreen
                economist p8: stone
                economist p9: navy
                economist p10: maroon
                economist p11: brown
                economist p12: lavender
                economist p13: teal
                economist p14: cranberry
                economist p15: khaki

                Comment

                Working...
                X