Announcement

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

  • -tabplot- (SSC) ignoring scheme-specific subtitle size?

    Dear Nick,
    I use -tabplot- from SSC in version 2.7.2 NJC 30 June 2017 and wonder why -tabplot- ignores a textsize for a subtitle given by my specific scheme. Whereas it looks like a charm which -ciplot- (from SSC version 1.1.1 from 2011). It would be great if you tell me if I can improve my code to get the subtitle textsize I want in -tabplot-. Thank you.

    My setup:
    I use a scheme based on s2color and created a -graphsetup- program as proposed by Ben Jann in "Customizing Stata Graphs made Easy (Part 1)", Stata Journal 18(3) https://doi.org/10.1177%2F1536867X1801800301.

    Code:
    sysuse auto, clear
    graphsetup 15 12
    tabplot foreign rep78, percent(foreign) sep(foreign) bar1(bcolor(red*0.5)) bar2(bcolor(blue*0.5)) showval(offset(0.05) format(%2.1f)) title("Subtitle size ignored") subtitle(% by origin) name(tabplot, replace)
    ciplot rep78,  by(foreign) subtitle(% by origin) title("Subtitle size respected") name(ciplot, replace)
    I receive the following graphs:
    - tabplot-
    Click image for larger version

Name:	tabplot.png
Views:	1
Size:	48.0 KB
ID:	1504924

    -ciplot-
    Click image for larger version

Name:	ciplot.png
Views:	1
Size:	46.6 KB
ID:	1504925

    My graphsetup- program:

    Code:
     program graphsetup
      args x y
        local xsize =`x'/2.54
      local ysize =`y'/2.54
      local rsize = min(`xsize', `ysize')
        foreach pt in.5.7511.5356810121416182228{
      local nm:subinstr local pt ".""_"
      local`nm'pt =`pt'/(`rsize'*72)*100
      }
            grstyle init
          grstyle graphsize x `xsize'
          grstyle graphsize y `ysize'
      
      
          grstyle symbolsize p `3pt'
          grstyle linewidth axisline `_5pt'
          grstyle linewidth tick `_5pt'
          grstyle linewidth major_grid `_5pt'
          grstyle linewidth legend `_5pt'
          grstyle linewidth xyline `_5pt'
     
        grstyle gsize `10pt'
          grstyle gsize gap `3pt'
          grstyle gsize text `8pt'
          grstyle gsize body `8pt'
          grstyle gsize small_body `6pt'
          grstyle gsize heading `12pt'
          grstyle gsize subheading `10pt'
          grstyle gsize axis_title `8pt'
          grstyle gsize matrix_label `16pt'
          grstyle gsize label `8pt'
          grstyle gsize small_label `6pt'
          grstyle gsize matrix_marklbl `3pt'
          grstyle gsize key_label `8pt'
          grstyle gsize note`6pt'
          grstyle gsize star `10pt'
          grstyle gsize text_option `10pt'
          grstyle gsize dot_rectangle `1pt'
          grstyle gsize axis_space `1_5pt'
          grstyle gsize axis_title_gap `1_5pt'
          grstyle gsize tick `3pt'
          grstyle gsize minortick `1_5pt'
      *   grstyle gsize minortick .55
          grstyle gsize tickgap `1_5pt'
          grstyle gsize notickgap `3pt'
          grstyle gsize tick_label `8pt'
          grstyle gsize tick_biglabel `10pt'
          grstyle gsize minortick_label `5pt'
          grstyle gsize filled_text `10pt'
          grstyle gsize reverse_big `16pt'
          grstyle gsize alternate_gap zero
          grstyle gsize title_gap `5pt'
          grstyle gsize key_gap `5pt'
          grstyle gsize key_linespace `5pt'
          grstyle gsize star_gap `_5pt'
          grstyle gsize legend_colgap `3pt'
          grstyle gsize label_gap `1_5pt'
          grstyle gsize matrix_mlblgap `1_5pt'
          grstyle gsize barlabel_gap `3pt'
            grstyle gsize legend_row_gap `3pt'
          grstyle gsize legend_col_gap `8pt'
          grstyle gsize legend_key_gap `5pt'
          grstyle gsize legend_key_ysize `3pt'
            grstyle gsize zyx2legend_key_gap `3pt'
          grstyle gsize zyx2legend_key_xsize `6pt'
          grstyle gsize zyx2legend_key_ysize `6pt'
          grstyle gsize zyx2rowgap zero
          grstyle gsize zyx2colgap `16pt'
            grstyle gsize clegend_width `22pt'
          grstyle gsize clegend_height zero
            grstyle gsize pie_explode `12pt'
          grstyle gsize pielabel_gap zero
            grstyle gsize plabel `8pt'
          grstyle gsize pboxlabel `8pt'
        *   grstyle gsize p#label `8pt'
      *   grstyle gsize p#boxlabel `8pt'
            grstyle gsize sts_risktable_space `1pt'
          grstyle gsize sts_risktable_tgap zero
          grstyle gsize sts_risktable_lgap zero
          grstyle gsize sts_risk_label `10pt'
          grstyle gsize sts_risk_title `10pt'
          grstyle gsize sts_risk_tick zero
            grstyle relsize bar_gap 0pct
          grstyle relsize bar_groupgap 67pct
          grstyle relsize bar_supgroupgap 200pct
          grstyle relsize bar_outergap 20pct
            grstyle relsize dot_gap neg100pct
          grstyle relsize dot_groupgap 0pct
          grstyle relsize dot_supgroupgap 67pct
          grstyle relsize dot_outergap 0pct
            grstyle relsize box_gap 33pct
          grstyle relsize box_groupgap 100pct
          grstyle relsize box_supgroupgap 200pct
          grstyle relsize box_outergap 20pct
          grstyle relsize box_fence 67pct
          grstyle relsize box_fencecap 0pct
     
        grstyle symbolsize `10pt'
          grstyle symbolsize symbol `10pt'
          grstyle symbolsize smallsymbol `8pt'
            grstyle symbolsize star `8pt'
          grstyle symbolsize histogram`8pt'
          grstyle symbolsize histback `8pt'
          grstyle symbolsize dots `3pt'
          grstyle symbolsize ci`8pt'
          grstyle symbolsize ci2 `8pt'
          grstyle symbolsize matrix`8pt'
          grstyle symbolsize refmarker `8pt'
          grstyle symbolsize sunflower`8pt'
            grstyle symbolsize backsymbol `8pt'
          grstyle symbolsize backsymspace `8pt'
          grstyle symbolsize p `8pt'
          grstyle symbolsize pback zero
          grstyle symbolsize parrow `8pt'
          grstyle symbolsize parrowbarb zero
          grstyle * symbolsize p#`16pt'
      *   grstyle symbolsize p#back `16pt'
      *   grstyle symbolsize p#box `16pt'
      *   grstyle symbolsize p#boxback `16pt'
      *   grstyle symbolsize p#dot `16pt'
      *   grstyle symbolsize p#dotback `16pt'
      *   grstyle symbolsize p#arrow `16pt'
      *   grstyle symbolsize p#arrowbarb `16pt'
     
    *** Allgemeine Vorgaben
      grstyle intensity p inten100
     
    
      end


  • #2
    I haven't studied Ben's stuff that you're using here. tabplot has its own idea of a default subtitle size, as the code shows, So, you'd need to spell out your own alternative preferences.

    This works:

    Code:
    sysuse auto, clear
    tabplot foreign rep78, percent(foreign) sep(foreign) ///
    bar1(bcolor(red*0.5)) bar2(bcolor(blue*0.5)) showval(offset(0.05) ///
    format(%2.1f)) title("Subtitle size can be specified") subtitle(% by origin, size(huge)) name(tabplot, replace)
    PS Not an issue here, but the version 2.7.2 you're citing, which is the latest public version, is from the Stata Journal website, not SSC.
    Last edited by Nick Cox; 26 Jun 2019, 05:55.

    Comment


    • #3
      Nick, thank you for your answer. Indeed, I forgot to look closely into the tabplot-code. I removed the
      Code:
       place(w) size(medsmall)
      parts of line 340 for my own work. I like to specify graph design by a scheme rather than by the graph-producing syntax. And while producing graphs for reports I like to keep the text size fixed although the graph size might differ.

      Comment


      • #4
        Stata allows graphics programs to overwrite settings in a graph scheme! Be sure to name your version something other than tabplot as you're going to get into a mess next time I update if you want to get that update. In fact 2.8.0 is already a gleam in my eye and the help file has already been revised several times on my work machine since the last public update.

        Comment


        • #5
          I am curious to see the 2.8 version and its additions. I renamed the file and put it in my personal folder - so I hope nothing gets confused when I get an update.

          Comment


          • #6
            Nick, while playing around with tabplot a bit in more detail. I am curious to see that the xlabel and ylabel as well as the bar value (with showval) have the same textsize. As far as I can see, it seems that -tabplot- invokes the gsize label value of a scheme rather than the gsize small_label value (which I expected) for barlabel.

            Now I tried to add mlabtextstyle(small_label) but it fails to have an impact.

            Code:
            tabplot foreign rep78, percent(foreign) sep(foreign) bar1(bcolor(red*0.5)) bar2(bcolor(blue*0.5)) showval(offset(0.05) format(%2.1f) ) mlabt(small_label) subtitle(% by origin) name(tabplot, replace)
            If I integrate mlabt(small_label) into showval() I get an syntax error:
            Code:
            . tabplot foreign rep78, percent(foreign) sep(foreign) bar1(bcolor(red*0.5)) bar2(bcolor(blue*0.5)) showval(offs
            > et(0.05) format(%2.1f)  mlabt(small_label)) subtitle(% by origin) name(tabplot, replace)
            invalid syntax
            r(198);


            Comment


            • #7
              There are two questions here. First, tabplot is just using xlabel() and ylabel() defaults in terms of label size. So, you have scope to influence that through schemes.

              Second, I can reproduce that syntax error and i have no explanation for it yet.

              Comment


              • #8
                Marc Kaulisch

                As a follow-up, I took the problematic extra out of tabplot context

                Code:
                sysuse auto, clear 
                scatter mpg weight if foreign, ms(none) mla(make) mlabc(black) mlabpos(0) mlabt(small_label)
                with the same error message, so I have the wicked pleasure of reporting that if this is a bug, it is not mine.

                Comment


                • #9
                  Nick Cox Thanks for letting me know. Curious to see what Stata Tech Support will say.

                  Comment


                  • #10
                    Indeed; I sent a query to Tech Support.

                    Comment


                    • #11
                      While looking through the What's new in Stata 16 I learn that it is now possible to express point sizes https://www.stata.com/new-in-stata/p...-for-graphics/. So my problem is solved indirectly. Of course, the syntax error is disturbing...

                      Comment


                      • #12
                        Derek Wagner (StataCorp) kindly sent this

                        You should only use mlabtextstyle() when you aren't using any other
                        label options (such as mlabsize(), etc.). From the help file:

                        You need not specify mlabstyle() just because there is something you want to change about the
                        look of a marker and, in fact, most people seldom specify the mlabstyle() option. You specify
                        mlabstyle() when another style exists that is exactly what you desire or when another style
                        would allow you to specify fewer changes to obtain what you want.

                        mlabtextstyle(textstyle) specifies the overall look of text of the marker labels, which here means
                        their size and color. When you see [G-4] textstyle, you will find that a textstyle defines much
                        more, but all of those other things are ignored for marker labels. In any case, the mlabsize()
                        and mlabcolor() options documented below allow you to change the size and color, but
                        mlabtextstyle() is the starting point.
                        This will work without mlabtextstyle():

                        Code:
                        scatter mpg weight if foreign, mla(make) mlabc(black) mlabsize(small) ///
                          mlabpos(0)
                        This will work with mlabtextstyle()

                        Code:
                        scatter mpg weight if foreign, mla(make) mlabpos(0) mlabtextstyle(label)
                        (ends)

                        So there you go. No bug anywhere.

                        Comment

                        Working...
                        X