Announcement

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

  • Remove boxes around titles on twoway graphs with by() option

    Hello,

    Using this data
    Code:
    clear
    input float percent byte step float(royalty country)
     .1571494  3 0 1
     .2404376  3 0 2
    .06155238  4 0 1
    .05145381  6 0 0
     9.002461  6 0 1
     3.793026  6 0 2
    .06405864  7 0 0
    1.6022737  7 0 1
     3.000558  7 0 2
     .3945906  8 0 1
    .09221147 10 0 2
    1.2064307 13 0 0
     .7898186 13 0 1
    .16656718 13 0 2
     .3831671 17 0 1
     .3525963 18 0 0
    .21560597 18 0 1
    1.6987464 18 0 2
    2.0441864  3 1 0
    2.0194564  3 1 1
    10.963936  3 1 2
    16.054878  6 1 0
     4.955963  6 1 1
     27.83438  6 1 2
     20.07116  7 1 0
     44.86825  7 1 1
     2.003608  7 1 2
    2.1940196  9 1 1
     1.459194 10 1 0
    2.1079886 11 1 1
     7.585959 13 1 0
    1.5773594 13 1 1
     4.309781 13 1 2
     2.562408 17 1 0
    4.5086374 17 1 1
    2.2169607 17 1 2
    1.4679245 18 1 0
    19.688713 18 1 1
     37.49014 18 1 2
            .  6 . 2
    end
    label values royalty royalty
    label def royalty 0 "King", modify
    label def royalty 1 "Queen", modify
    label values country treatment
    label def treatment 0 "France", modify
    label def treatment 1 "Britain", modify
    label def treatment 2 "Spain", modify
    And this code
    Code:
    twoway (line percent step if royalty==1, col(green)) ///
           (line percent step if royalty==0, col(blue)), ///
           by(country, cols(3) graphregion(col(white))) ///
           legend(ring(1) col(2) lab(1 "King") lab(2 "Queen") ///
           size(3) region(c(none))) xlab(3 4 6 7 8 9 11 13 17 18) name(graphy2, replace)
    Produces this graph
    Click image for larger version

Name:	graphy.png
Views:	1
Size:	76.4 KB
ID:	1415198

    I've spent way too much time trying to figure out how to get rid of the blue boxes around the titles. Ideally the titles will have no boxes around them and no shading. I ended up at this helpfile: https://www.stata.com/manuals13/g-3title_options.pdf but neither the bexpand box options do much (or anything at all) for me.

    Can anyone help?





  • #2
    Thanks for your example although I think your graph scheme needs to be specified as well. I found progress from adding options


    Code:
      subtitle(, fcolor(none) lstyle(none)) scheme(s1color)

    Comment


    • #3
      Thanks Nick! I can live with what the subtitle options produce sans scheme(s1color). Much appreciated

      Comment


      • #4
        Just in case anyone ever stumbles on this with the same problem, the below code does the trick:


        Code:
        twoway (line percent step if royalty==1, col(green)) ///
               (line percent step if royalty==0, col(blue)), ///
               by(country, cols(3) graphregion(col(white))) ///
               subtitle(, fcolor(white) lcol(white)) ///
               legend(ring(1) col(2) lab(1 "King") lab(2 "Queen") ///
               size(3) region(c(none))) xlab(3 4 6 7 8 9 11 13 17 18) name(graphy3, replace)

        Comment


        • #5
          Code:
          sysuse auto, clear
          scatter mpg weight, by(foreign) subtitle(,nobox)

          Comment

          Working...
          X