Announcement

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

  • #16
    Yes, the folder is writable. I've taken the discussion here:

    https://github.com/wbuchanan/brewscheme/issues/21

    Comment


    • #17
      Thanks to Andy dB, a few issues were teased out and fixed with the distribution files. One issue (in particular) may affect others using Windoze and if you already have the program installed you can use:

      Code:
      // Update if already installed from GitHub repository/project page
      adoupdate brewscheme, update
      
      // Install over the existing programs
      net inst brewscheme, from("http://wbuchanan.github.io/brewscheme/") replace
      The Windoze specific issue is local to the filesys command which is used internally in several locations and was causing a Java exception to be thrown. The Java binary is still fine, but the ado wrapper had some lines that were not in the appropriate sequence in an if/else block that cause the wrong argument to be passed to the Java plugin.

      Comment


      • #18
        Terrific support - everything worked well now (on Win10).

        Comment


        • #19
          Andy dB Thanks for the complements. Hopefully this will have been the last of the bugs and once I finish writing/revising an SJ article about the package I'll finally get a version 1.0.0 release out.

          Comment


          • #20
            wbuchanan: First of all, thanks a lot for sharing your package. I've been playing around with it and already got useful results. But I find it difficult (if not impossible) to understand the options from brewtheme and the strings to put in there. Does a more detailed documentation exist yet? Or will that be included in the SJ article you're currently working on?

            Also, do you have an idea on how to easily build up your own theme from scratch? That is, changing options and reviewing the effects often and repeatedly. At the moment, this is somewhat cumbersome since I have to delete all generated theme and scheme files and restart Stata before creating the new files. Otherwise the changes have no effect.

            Comment


            • #21
              Matthias Gomolka you shouldn't need to restart Stata to do check on things. Building out the documentation for -brewtheme- is one of the things that I still have to get to. The difficult thing is that it isn't always clear from the existing documentation what all of the different options control. In short, the options in brewtheme are based on the entries in the s2color scheme, with the default theme being modified from the s2color scheme to set the background white, remove horizontal grid lines, etc...

              In terms of examples, there is an example showing how to build a theme that imitates the ggplot2 aesthetic characteristics on the project page. I've copied that example, and the example that modifies the values in the theme file to basically get back to the s2color scheme (there are a few minor differences due to how the files are split):

              Code:
              // Change the end of line delimiter 
              #d ;
              
              // Generate the theme file used to simulate ggplot2 aesthetics
              brewtheme ggtheme, numticks("major 5" "horizontal_major 5" "vertical_major 5"     
              "horizontal_minor 10" "vertical_minor 10") color("plotregion gs15"                 
              "matrix_plotregion gs15" "background gs15" "textbox gs15" "legend gs15"         
              "box gs15" "mat_label_box gs15" "text_option_fill gs15" "clegend gs15"             
              "histback gs15" "pboxlabelfill gs15" "plabelfill gs15" "pmarkbkfill gs15"         
              "pmarkback gs15") linew("major_grid medthick" "minor_grid thin" "legend medium"    
              "clegend medium") clockdir("legend_position 3") yesno("draw_major_grid yes"     
              "draw_minor_grid yes" "legend_force_draw yes" "legend_force_nodraw no"             
              "draw_minor_vgrid yes" "draw_minor_hgrid yes" "extend_grid_low yes"             
              "extend_grid_high yes" "extend_axes_low no" "extend_axes_high no")                 
              gridsty("minor minor") axissty("horizontal_default horizontal_withgrid"         
              "vertical_default vertical_withgrid") linepattern("major_grid solid"             
              "minor_grid solid") linesty("major_grid major_grid" "minor_grid minor_grid")     
              ticksty("minor minor_notick" "minor_notick minor_notick")                         
              ticksetsty("major_vert_withgrid minor_vert_nolabel"                             
              "major_horiz_withgrid minor_horiz_nolabel"                                         
              "major_horiz_nolabel major_horiz_default"                                         
              "major_vert_nolabel major_vert_default") gsize("minortick_label minuscule"             
              "minortick tiny") numsty("legend_cols 1" "legend_rows 0" "zyx2rows 0" "zyx2cols 1")                         
              verticaltext("legend top");
              
              // Generates a theme in the style of s2color
              brewtheme s2theme, graphsi("x 5.5" "y 4") numsty("legend_cols 2" "legend_rows 0" 
              "zyx2rows 0" "zyx2cols 1") gsize("label medsmall" "small_label small"
              "text medium" "body medsmall" "small_body small" "heading large" 
              "axis_title medsmall" "matrix_label medlarge" "matrix_marklbl small" 
              "key_label medsmall" "note small" "star medsmall" "text_option medsmall" 
              "minor_tick half_tiny" "tick_label medsmall" "tick_biglabel medium" 
              "title_gap vsmall" "key_gap vsmall" "key_linespace vsmall" "legend_key_xsize 13" 
              "legend_key_ysize medsmall" "clegend_width huge" "pielabel_gap zero" "plabel small" 
              "pboxlabel small" "sts_risktable_space third_tiny" "sts_risktable_tgap zero" 
              "sts_risktable_lgap zero" "minortick half_tiny" "pie_explode medium") 
              relsize("bar_groupgap 67pct" "dot_supgroupgap 67pct" 
              "box_gap 33pct" "box_supgroupgap 200pct" "box_outergap 20pct" "box_fence 67pct") 
              symbolsi("smallsymbol small" "histogram medlarge" "ci medium" "ci2 medium" 
              "matrix medium" "refmarker medlarge" "parrowbarb zero") 
              color("background ltbluishgray" "foreground black" "backsymbol gs8" 
              "heading dknavy" "box bluishgray" "textbox bluishgray" 
              "mat_label_box bluishgray" "text_option_line black" 
              "text_option_fill bluishgray" "filled bluishgray" "bylabel_outline bluishgray" 
              "reverse_big navy" "reverse_big_line navy" "grid ltbluishgray" 
              "major_grid ltbluishgray" "minor_grid gs5" "matrix navy" "matrixmarkline navy" 
              "histback gold" "legend_line black" "clegend white" "clegend_line black" 
              "pboxlabelfill bluishgray" "plabelfill bluishgray") linepattern("foreground solid" 
              "background solid" "grid solid" "major_grid solid" "minor_grid dot" 
              "text_option solid") linesty("textbox foreground" "grid grid" 
              "major_grid major_grid" "minor_grid minor_grid" "legend legend") 
              linewidth("p medium" "foreground thin" "background thin" "grid medium" 
              "major_grid medium" "minor_grid thin" "tick thin" "minortick thin" 
              "ci_area medium" "ci2_area medium" "histogram medium" "dendrogram medium" 
              "xyline medium" "refmarker medium" "matrixmark medium" "dots vvthin" 
              "dot_area medium" "dotmark thin" "plotregion thin" "legend thin" "clegend thin" 
              "pie medium" "sunflower medium" "text_option thin" "pbar vvvthin") 
              textboxsty("note small_body" "leg_caption body") 
              axissty("bar_super horizontal_nolinetick" "dot_super horizontal_nolinetick" 
              "bar_scale_horiz horizontal_withgrid" "bar_scale_vert vertical_withgrid" 
              "box_scale_horiz horizontal_withgrid" "box_scale_vert vertical_withgrid") 
              clockdir("caption_position 7" "legend_position 6" "by_legend_position 6" "p 3" 
              "legend_caption_position 7")  gridringsty("caption_ring 5" 
              "legend_caption_ring 5") anglesty("vertical_tick vertical") 
              yesno("extend_axes_low no" "extend_axes_high no" "draw_major_vgrid yes" 
              "use_labels_on_ticks no" "title_span no" "subtitle_span no" "caption_span no" 
              "note_span no" "legend_span no") barlabelsty("bar none");
              You should be able to create a theme file with brewtheme and then use that as an option to brewscheme. From there you should be able to use the new scheme files in graphs without having to restart. If you have difficulties, you can use the -discard- command which is like clear but will also dump any of the graphs cached in memory as well as the associated schemes. Let me know if this helps.

              Comment


              • #22
                Matthias Gomolka the updates aren't part of the distributed package just yet, but if you really wanted to make them accessible from Stata you could copy the new help files (and remove the previously installed helpfiles) using something like:

                Code:
                loc oldhelpfiles : dir `"`c(sysdir_plus)'b/"' file "bt*.sthlp"
                foreach v of loc oldhelpfiles {
                    erase `"`c(sysdir_plus)'b/`v'"'
                    copy "https://raw.githubusercontent.com/wbuchanan/brewthemehelp/master/`v'" `"`c(sysdir_plus)'b/`v'"'
                }
                erase `"`c(sysdir_plus)'b/brewtheme.sthlp"'
                copy "https://raw.githubusercontent.com/wbuchanan/brewscheme/master/brewtheme.sthlp" `"`c(sysdir_plus)'b/brewtheme.sthlp"'
                The updates I just made show all of the default values being used by brewtheme. I'm going to be trying to locate where - if anywhere - the official documentation references the scheme entries to make the first table contain links to the official Stata documentation along with the valid values. If there's anything you think could make the help files more useful, please don't be shy about saying so. It doesn't do much good to have the program out there if others aren't able to use it easily, so any suggestions for improvements are always welcome.

                Comment


                • #23
                  wbuchanan Thanks a lot for your quick response. The - discard - command is really helpful. Makes testing far more convenient. Also the options for the s2theme are useful, since it includes more options than your ggplot2 example. So I can continue putting together my own theme now.

                  For some reason I could not download the new help file from inside Stata. Perhaps because of institutional security settings... Anyway, I found it on your github repository an copied it in the directory by hand.
                  Last edited by Matthias Gomolka; 26 Feb 2016, 06:03.

                  Comment


                  • #24
                    Just one more question that came to my mind: Is it possible to control the number format of the axis tick labels? If yes, which I assume, do you know how this would be done?

                    Comment


                    • #25
                      Matthias Gomolka I'm not sure I've come across anything about the number formatting on the axes (although I can definitely see how that would be useful). My intuition is that Stata inherits the display format from the variable itself, but I wouldn't know the specifics. In general if you're wanting information about details of graphics in Stata any of the data visualization oriented Stata Conference presentations from Vince Wiggins (StataCorp), Bill Rising (StataCorp), and Sergiy Radyakin are extremely valuable resources, but I don't think any of them explicitly addressed number formatting on the axes. The closest thing that I could think of would be to use :

                      Code:
                      yesno("use_labels_on_ticks yes")
                      


                      But other than setting it to use the value labels I'm not sure if there is anything directly in the schemes that would handle this. From a design perspective it would make more sense to inherit from the display format since it would keep output in the results pane and output in graphs consistent (in terms of how the data are displayed), but there may be something I've overlooked.

                      Comment


                      • #26
                        wbuchanan yesno("use_labels_on_ticks yes") does not lead to a change in my examplegraph. But your intuition about the inheritage of the display format was (partially) correct. This works perfectly for the x-axis, but not for the y-axis. Until now, I could not figure out why. I guess, I have to wait for the final documentation. Thanks a lot for your help so far!

                        Comment


                        • #27
                          Matthias Gomolka that was the only thing I could find that would have any effect on the formatting/values that would be displayed, but I'm not sure why it only worked on one axis and not the other. Are you able to post an example of what you were doing with one of the system data sets?

                          Comment


                          • #28
                            wbuchanan Here is the do file I use to produce my custom scheme. It is likely that there are some (or many) options that are not necessary, since I simply took your information about the s2color scheme and tried to play around with it.
                            Code:
                            discard
                            
                            // 1. create theme
                            
                            brewtheme custom, graphsi("x 6.45" "y 4")    ///
                                numsty("legend_cols 0" "legend_rows 2" "zyx2rows 0" "zyx2cols 1")    ///
                                gsize("label med" "small_label small" "text medium" "body medsmall" "small_body small" "heading large" "axis_title small" "matrix_label medlarge" "matrix_marklbl small" "note small" "star medsmall" "text_option medsmall" "minor_tick half_tiny" "tick_label small" "tick_biglabel medium" "title_gap vsmall" "key_gap vsmall" "key_linespace vsmall" "legend_key_xsize 4" "legend_key_ysize medsmall" "key_label small" "clegend_width huge" "pielabel_gap zero" "plabel small" "pboxlabel small" "sts_risktable_space third_tiny" "sts_risktable_tgap zero" "sts_risktable_lgap zero" "minortick half_tiny" "pie_explode medium")    ///
                                relsize("bar_groupgap 67pct" "dot_supgroupgap 67pct" "box_gap 33pct" "box_supgroupgap 200pct" "box_outergap 20pct" "box_fence 67pct")    ///
                                symbolsi("smallsymbol small" "histogram medlarge" "ci medium" "ci2 medium" "matrix medium" "refmarker medlarge" "parrowbarb zero")    ///
                                color("axisline black" "tick gs12" "tick_label black" "grid gs12" "major_grid gs12" "minor_grid gs12" "matrix navy" "matrixmarkline navy" "histback gold" "legend_line white" "clegend white" "clegend_line black" "pboxlabelfill bluishgray" "plabelfill bluishgray")    ///
                                linepattern("foreground solid" "background solid" "grid solid" "major_grid solid" "minor_grid dot" "text_option solid")    ///
                                linesty("textbox foreground" "grid grid" "major_grid major_grid" "minor_grid minor_grid" "legend legend")    ///
                                linewidth("p medium" "foreground thin" "background thin" "grid thin" "major_grid thin" "minor_grid thin" "tick thin" "minortick thin" "ci_area medium" "ci2_area medium" "histogram medium" "dendrogram medium" "xyline medium" "refmarker medium" "matrixmark medium" "dots vvthin" "dot_area medium" "dotmark thin" "plotregion thin" "legend thin" "clegend thin" "pie medium" "sunflower medium" "text_option thin" "pbar vvvthin")    ///
                                textboxsty("note small_body" "leg_caption body")    ///
                                axissty("horizontal_default horizontal_withgrid" "vertical_default vertical_withgrid" "bar_super horizontal_nolinetick" "dot_super horizontal_nolinetick" "bar_scale_horiz horizontal_withgrid" "bar_scale_vert vertical_withgrid" "box_scale_horiz horizontal_withgrid" "box_scale_vert vertical_withgrid")    ///
                                clockdir("caption_position 7" "legend_position 6" "by_legend_position 6" "p 3" "legend_caption_position 7")    ///
                                gridringsty("caption_ring 5" "legend_caption_ring 5")    ///
                                anglesty("vertical_tick horizontal")    ///
                                yesno("extend_axes_low yes" "extend_axes_high no" "draw_major_vgrid yes" "draw_major_hgrid yes" "use_labels_on_ticks yes" "title_span yes" "subtitle_span yes" "caption_span no" "note_span yes" "legend_span yes") ///
                                barlabelsty("bar none")
                                
                            // 2. create scheme file (using theme)
                            brewscheme,    schemename(custom)    ///
                                themefile(custom)    ///
                                allstyle(ggplot2)    ///
                                allcolors(5)    ///
                                allsaturation(75)    
                                
                             
                            // 3. Example  
                            sysuse auto.dta, clear
                            format price weight %12,0gc
                            set scheme custom
                            
                            twoway (fpfitci price weight) (scatter price weight if rep78==1, sort) (scatter price weight if rep78==2, sort) (scatter price weight if rep78==3, sort) (scatter price weight if rep78==4, sort) (scatter price weight if rep78==5, sort), title("Example Graph") legend(order(3 "1978 Repair Record = 1" 4 "1978 Repair Record = 2" 5 "1978 Repair Record = 3" 6 "1978 Repair Record = 4" 7 "1978 Repair Record = 5" 1 "Confidence Interval"))
                            Here is the resulting graph showing the desired number format on the x-axis but not on the y-axis (I'm located in Germany as you can see from the formatting).
                            Click image for larger version

Name:	Graph.png
Views:	1
Size:	28.3 KB
ID:	1328824




                            By the way, when you already look at this example, why is there no horizontal line at y=0?

                            PS: If the code example is too confusing because of the linebreaks please tell me and I will provide an adjusted piece of code (the one above is very clear in Notepad++).

                            Comment


                            • #29
                              Matthias Gomolka it might be a good idea to submit this as a potential bug in the project repository and include the do file there as well. It wouldn't surprise me too much if it were an issue with something related to the operating system, so I'll see if it replicates on my MacBook. If nothing else, I've reformatted your code example in a way that I hope fits a bit better on the screen:

                              Code:
                              discard
                              #d ;
                              
                              // 1. create theme
                              brewtheme custom, graphsi("x 6.45" "y 4") 
                              numsty("legend_cols 0" "legend_rows 2" "zyx2rows 0" "zyx2cols 1")   
                              gsize("label med" "small_label small" "text medium" "body medsmall"    
                              "small_body small" "heading large" "axis_title small" "matrix_label medlarge" 
                              "matrix_marklbl small" "note small" "star medsmall" "text_option medsmall" 
                              "minor_tick half_tiny" "tick_label small" "tick_biglabel medium" 
                              "title_gap vsmall" "key_gap vsmall" "key_linespace vsmall" 
                              "legend_key_xsize 4" "legend_key_ysize medsmall" "key_label small" 
                              "clegend_width huge" "pielabel_gap zero" "plabel small" "pboxlabel small" 
                              "sts_risktable_space third_tiny" "sts_risktable_tgap zero" 
                              "sts_risktable_lgap zero" "minortick half_tiny" "pie_explode medium")    
                              relsize("bar_groupgap 67pct" "dot_supgroupgap 67pct" "box_gap 33pct" 
                              "box_supgroupgap 200pct" "box_outergap 20pct" "box_fence 67pct")   
                              symbolsi("smallsymbol small" "histogram medlarge" "ci medium" "ci2 medium" 
                              "matrix medium" "refmarker medlarge" "parrowbarb zero")    
                              color("axisline black" "tick gs12" "tick_label black" "grid gs12" 
                              "major_grid gs12" "minor_grid gs12" "matrix navy" "matrixmarkline navy" 
                              "histback gold" "legend_line white" "clegend white" "clegend_line black" 
                              "pboxlabelfill bluishgray" "plabelfill bluishgray")    
                              linepattern("foreground solid" "background solid" "grid solid" 
                              "major_grid solid" "minor_grid dot" "text_option solid")    
                              linesty("textbox foreground" "grid grid" "major_grid major_grid" 
                              "minor_grid minor_grid" "legend legend")  
                              linewidth("p medium" "foreground thin" "background thin" "grid thin" 
                              "major_grid thin" "minor_grid thin" "tick thin" "minortick thin" 
                              "ci_area medium" "ci2_area medium" "histogram medium" "dendrogram medium" 
                              "xyline medium" "refmarker medium" "matrixmark medium" "dots vvthin" 
                              "dot_area medium" "dotmark thin" "plotregion thin" "legend thin" 
                              "clegend thin" "pie medium" "sunflower medium" "text_option thin" "pbar vvvthin") 
                              textboxsty("note small_body" "leg_caption body")  
                              axissty("horizontal_default horizontal_withgrid" 
                              "vertical_default vertical_withgrid" "bar_super horizontal_nolinetick" 
                              "dot_super horizontal_nolinetick" "bar_scale_horiz horizontal_withgrid" 
                              "bar_scale_vert vertical_withgrid" "box_scale_horiz horizontal_withgrid" 
                              "box_scale_vert vertical_withgrid") 
                              clockdir("caption_position 7" "legend_position 6" "by_legend_position 6" 
                              "p 3" "legend_caption_position 7")    
                              gridringsty("caption_ring 5" "legend_caption_ring 5")   
                              anglesty("vertical_tick horizontal")   
                              yesno("extend_axes_low yes" "extend_axes_high no" "draw_major_vgrid yes" 
                              "draw_major_hgrid yes" "use_labels_on_ticks yes" "title_span yes" 
                              "subtitle_span yes" "caption_span no" "note_span yes" "legend_span yes") 
                              barlabelsty("bar none");
                              
                              // 2. create scheme file (using theme)
                              brewscheme, schemename(custom) themefile(custom) allstyle(ggplot2) allcolors(5) 
                              allsaturation(75);
                              
                              
                              // 3. Example  
                              sysuse auto.dta, clear;
                              
                              format price weight %12,0gc;
                              
                              // Unless you're planning on hand coding a lot of graphs, I would personally 
                              // avoid setting the scheme globally
                              // set scheme custom
                              
                              // And pass the scheme as an argument to the graph command
                              twoway (fpfitci price weight) 
                              (scatter price weight if rep78==1, sort) 
                              (scatter price weight if rep78==2, sort) 
                              (scatter price weight if rep78==3, sort) 
                              (scatter price weight if rep78==4, sort) 
                              (scatter price weight if rep78==5, sort), title("Example Graph") 
                              legend(order(3 "1978 Repair Record = 1" 4 "1978 Repair Record = 2" 
                              5 "1978 Repair Record = 3" 6 "1978 Repair Record = 4" 
                              7 "1978 Repair Record = 5" 1 "Confidence Interval"))
                              scheme(custom);
                              My best guess at the horizontal access line is that it may be an issue with the use of horizontal_nolinetick. There are a few things that still cannot be customized directly from the scheme files themselves (e.g., if you use minor_grid styles then labels will show up) but I'll try to look into this and let you know if I figure something out.

                              Comment


                              • #30
                                wbuchanan and Andy dB -- I've encountered similar errors trying to use brewscheme with Stata/SE 14.1. I was able to install the package, however. Not sure why I have the following errors.


                                Code:
                                . sysuse auto, clear
                                (1978 Automobile Data)
                                
                                . brewscheme, scheme(test) allstyle(dark2) allcolor(7)
                                file http://www.colorbrewer2.org/colorbrewer_schemes.js not found
                                server says file permanently redirected to http://colorbrewer2.org/colorbrewer_schemes.js
                                r(601);
                                Nathan E. Fosse, PhD
                                [email protected]

                                Comment

                                Working...
                                X