Announcement

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

  • 538 and ggplot themes failing in Stata 15

    I tried out some recently released themes by Dan Bischof, one of them emulating ggplot's style and the other emulating 538's style. I think he improves on some default Stata graphics style choices in the standard schemes. However, in Stata 15.1 these Bischof schemes throw a lot of errors resulting in default options being used in the plot instead of those specified in the new schemes. The author says he's aware of these issues but doesn't have Stata 15 to solve them. Has anyone altered their copies of these schemes to fix the problems?

    ssc install g538schemes
    ssc install blindschemes


  • #2
    There is an example of how to build a custom scheme to emulate the ggplot2 aesthetics with brewscheme (https://wbuchanan.github.io/brewscheme). Have you tried that as a means to achieving the same goal?

    Comment


    • #3
      If you add the following lines below (taken from scheme-s2color.scheme) to the 538 scheme it will remove notes in the Results window:

      Code:
      . scatter price weight mpg, scheme(538w)
      (note:  alignstroke foreground not found in scheme, default attributes used)
      (note:  alignstroke not found in scheme, default attributes used)
      (note:  alignstroke tick not found in scheme, default attributes used)
      (note:  alignstroke not found in scheme, default attributes used)
      ...
      Code:
      anglestyle symbol          zero
      anglestyle psymbol         zero
      alignstroke axisline           inside
      alignstroke background         inside
      alignstroke ci_area            inside
      alignstroke ci                 inside
      alignstroke clegend            inside
      alignstroke dendrogram         inside
      alignstroke dot_area           inside
      alignstroke dot                inside
      alignstroke dotmark            inside
      alignstroke dots               inside
      alignstroke foreground         inside
      alignstroke grid               inside
      alignstroke histogram          inside
      alignstroke legend             inside
      alignstroke major_grid         inside
      alignstroke map                center
      alignstroke matrixmark         inside
      alignstroke matrix_plotregion  center
      alignstroke mat_label_box      center
      alignstroke minor_grid         inside
      alignstroke minortick          inside
      alignstroke pie                inside
      alignstroke p                  inside
      alignstroke plotregion         inside
      alignstroke refline            inside
      alignstroke refmarker          inside
      alignstroke reverse_big        inside
      alignstroke sunflower          inside
      alignstroke text_option        inside
      alignstroke tick               inside
      alignstroke xyline             inside
      alignstroke zyx2               inside
      
      alignstroke p1    inside
      alignstroke p2    inside
      alignstroke p3    inside
      alignstroke p4    inside
      alignstroke p5    inside
      alignstroke p6    inside
      alignstroke p7    inside
      alignstroke p8    inside
      alignstroke p9    inside
      alignstroke p10   inside
      alignstroke p11   inside
      alignstroke p12   inside
      alignstroke p13   inside
      alignstroke p14   inside
      alignstroke p15   inside

      Comment


      • #4
        I can confirm that Scott's addition nixes the annoying error messages. It looks like s2color.scheme was updated this year. I have not tried brewscheme, but because I'd like to make a company scheme I will look at it. Thank you William and Scott.

        . which scheme-s2color.scheme
        C:\Program Files (x86)\Stata15\ado\base\s\scheme-s2color.scheme
        *! version 1.3.4 08nov2017

        Comment


        • #5
          Comparing plots made in Stata 14.1 to 15.1 they are not the same in the ggplot scheme plottig so something else is also going on. The default first plot symbol was a small diamond previously and now it is a larger circle. It is time I learned more about scheme anyway.

          Dave

          Comment


          • #6
            Dave Airey
            I haven’t updated brewscheme for Stata 15 just yet, but the differences pointed out above are definitely useful to know about. If you need any help with things feel free to let me know since I imagine it will help to make brewscheme more useful for others as well.

            Comment


            • #7
              Here is a quote from the section "Creating your own schemes" in
              help scheme files:

              To create a new scheme, say mine, you need only create a file
              with the name scheme-mine.scheme in your PERSONAL directory
              (see [P] sysdir). You should always base your scheme on a scheme
              shipped with Stata or on another scheme based on an official scheme
              shipped with Stata. You do that by putting the line

              #include schemename

              before any scheme-file entries in your scheme. If you want to base your
              scheme on the scheme Stata uses by default when shipped, the line should
              read

              #include s2color
              Dave could fix the 538 schemes by creating a new scheme file.
              For example, let's create our own scheme based on 538w.
              Start by creating a new scheme file, say scheme-my538w.scheme,
              with the following contents:

              Code:
              #include s2color
              #include 538w
              The first line includes Stata's factory default scheme, just to future
              proof our scheme. The second line includes the 538w scheme.

              Then place the new scheme file in your PERSONAL directory. Type

              Code:
              sysdir
              to see where your PERSONAL directory resides.

              Now you can use graph option scheme(my538w) or set this
              new scheme as your default with set scheme my538w.

              Comment


              • #8
                Dear all,

                Germán Rodriguez made me aware of this discussion and the presented solution.

                Thanks a lot Scott.

                I will add this to all my schemes and upload the new versions on SSC archive tomorrow. It usually takes a while for the schemes to then be available online. But I suspect somewhen during the weekend the issue should be addressed.

                Best
                Daniel

                Comment


                • #9
                  So Daniel's schemes broke because they did not have the "#include s2color" line? Good lesson! I tested just the two line fix from Jeff and it does fix the messages, so no need to copy the lines from Scott into the fix. This implies that Daniel can just add #include s2color to his files. I tested this and this is true too.

                  Thanks all.

                  Dave

                  Comment


                  • #10
                    Dave Airey
                    I wouldn’t necessarily say that it “broke” it per se. I’d think of it more like a missing data problem. You can still fit a model w/missing data, but may not have all of the information present to fully inform the end result.

                    Comment


                    • #11
                      Jeff Pitblado (StataCorp)
                      You wouldn’t happen to be able to help me document some of the undocumented scheme parameters/attributes would you? I have the helpfile for brewtheme set up to point at the official documentation for any/every reference I could find.

                      Comment


                      • #12
                        Daniel Bischof
                        If you could announce when you have fixed the issue by adding #inlcude s2color, I'd appreciate it. Thanks. My package was updated today but the fix was not apparent, and I could not find the added line in the file.

                        Comment


                        • #13
                          Based on a similar thread from years back, I believe these error messages mean that g538schemes is platform/architecture-dependent and that no installation pkg exists for Linux 64bit?

                          Code:
                          . about
                          
                          Stata/IC 15.1 for Unix (Linux 64-bit x86-64)
                          Revision 21 Nov 2017
                          Copyright 1985-2017 StataCorp LLC
                          
                          Total usable memory:   15.60 GB
                          
                          Single-user Stata perpetual license:
                                 Serial number:  XXXXXXXXXXXX
                          
                          . display "$S_DATE $S_TIME"
                           5 Dec 2017 17:39:36
                          
                          . ssc install g538schemes, replace all
                          nothing to install
                          
                          . net inst g538schemes, from(http://fmwww.bc.edu/RePEc/bocode/g)
                          nothing to install

                          Comment


                          • #14
                            No, I get that message too on Windows.

                            Comment


                            • #15
                              How disappointing! I went to Daniel Bischof's personal site and he's got the solution provided by Scott posted as his fix, not the solution provided by Jeff. Jeff's solution handles errors in other plot types, not just scatter, because it includes all differences between the new and old s2color scheme file. And it is recommended when building a new scheme based off of another. Also, as noted, there is now nothing to download from SSC, at least for now.

                              Comment

                              Working...
                              X