Announcement

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

  • Color schemes and color palettes - setting default colors for graphs

    I have a list of colors from my workplace that we should use for all the graphs I create. Ideally I would just use these colors to create a new scheme and set it as default. I have created a scheme file that contains the following (modified from http://www.statsml.com/making-a-colo...hs-in-stata/):

    Code:
    #include s2color
     
    *color heading "122 26 23" // Title color
    *color background "246 226 180" // Background color
     
    // Colors for the bars-- a modification from s2color
    color p1bar      "11 78 67"
    color p2bar      "159 127 80"
    color p3bar      "205 48 40"
    color p4bar      "37 64 143"
    color p5bar      "130 130 127"
    color p6bar      "167 200 151"
    color p7bar      "205 120 40"
    color p8bar      "252 206 189"
    color p9bar      "135 202 208"
    color p10bar      "221 220 211"
     
    // outlines for the bars:
    // assign same color as the bars to have no outline
     
    color p1       "11 78 67"
    color p2       "159 127 80"
    color p3       "205 48 40"
    color p4       "37 64 143"
    color p5       "130 130 127"
    color p6       "167 200 151"
    color p7       "205 120 40"
    color p8       "252 206 189"
    color p9       "135 202 208"
    color p10       "221 220 211"
    I've saved this as scheme-newscheme.scheme in multiple path names including C:\ado but it does not get added to my list of available schemes when I type:

    Code:
    graph query, schemes
    I can create a palette for the colors:

    Code:
    program colorpalette_newpalette
    c_local P #0b4e43,#9f7f51,#cd3028,#25408f,#82827f,#a7c897,#c d7828,#fccebd,#87cad0,#dddcd3
    end
    but don't know how to make those colors default for graphs. I've tried running brewscheme but multiple layers of errors occur, which others have posted about without resolution.

    It seems to me that setting default graph colors should be quite straightforward but I'm having a lot of trouble sorting this out.

  • #2
    To find out where Stata is looking on your machine you can type in Stata help sysdir. You should then look for the entry PERSONAL: (normally I don't like using all capital letters, but that is the name of the entry). You go to that directory and look for a folder named s (just the single letter s). If it does not yet exist, create it. In that folder you should store the file scheme-newscheme.scheme .

    Another thing I could imagine is that you used something like MS Word to create that scheme file. It tends to add its own extension to the file name (.docx) and under certain settings Windows will hide known extensions like .docx. So in that case it appears you have stored scheme-newscheme.scheme, but instead you stored scheme-newscheme.scheme.docx . I don't know if that is the case for you, I am just trying to think of scenarios that could result in the kind of behavior you see.
    ---------------------------------
    Maarten L. Buis
    University of Konstanz
    Department of history and sociology
    box 40
    78457 Konstanz
    Germany
    http://www.maartenbuis.nl
    ---------------------------------

    Comment


    • #3
      Thank you Maarten,

      I have tried all that you suggest and have the file in the 's' folder (it didn't exist in 'personal' but I created it). It still doesn't appear in my list of available schemes.

      I had already double checked that it was truly a text file and had the correct extension.

      Comment

      Working...
      X