Announcement

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

  • Changing axes font in graph

    Hi. I'm struggling to change the font of the x and y axes of a line graph. The following code changes the font of the labels, and the legend, but leaves the axis numbers in the default Arial. Thanks for any help.

    Code:
     label var sm5_ex3_dent1 "{stSerif:NS Denials: Stricter}";
     label var sm5_ex3_dent2 "{stSerif:NS Denials: Less strict}";
     label var sm5_ex3_all "{stSerif:51 programs}";
    
     graph set window fontface stSerif;
     line sm5_ex3_dent1 sm5_ex3_dent2 sm5_ex3_all year_month,
          xtitle("{stSerif:Base month}") ytitle("{stSerif:Monthly job-finding rate}")
          ylabel(0.15(.05).35)
          lc(black black green)
          xlabel(708(12)743, format(%tmCCYY) notick) xtick(708(3)749, add)
          legend(cols(2)rows(2))
          saving(fig2, replace);

  • #2
    Here's the full figure code, in case helpful:

    Code:
    clear all
    cd "C:\Users\mckennac\Documents\1_research\__dissertation\survey-data\_cps\data"
    
    #delimit;
    clear *;
    set scheme s2mono;
    
    use if none1==1 & exit1a<. using bms_2019_22_cma;
    drop if year_month<708;
    keep if sampnone1==1 & age>=18 & age<65;
    
    gen ex3_dent1=reemp if hidh==1;
    gen ex3_dent2=reemp if hidh==0;
    gen ex3_all=reemp;
    
    collapse (mean) ex3_* [aw=wtfinl], by(year_month);
     foreach v of varlist ex3_* {;
       gen sm5_`v'=(1/9)*`v'[_n-2] + (2/9)*`v'[_n-1] + (3/9)*`v' + (2/9)*`v'[_n+1] + (1/9)*`v'[_n+2];
       replace sm5_`v'=(1/8)*`v'[_n-2] + (2/8)*`v'[_n-1] + (3/8)*`v' + (2/8)*`v'[_n+1] 
                       if `v'[_n+2]==.;
       replace sm5_`v'=(1/6)*`v'[_n-2] + (2/6)*`v'[_n-1] + (3/6)*`v'
                       if `v'[_n+1]==.;
       replace sm5_`v'=(2/8)*`v'[_n-1] + (3/8)*`v' + (2/8)*`v'[_n+1] + (1/8)*`v'[_n+2]
                       if `v'[_n-2]==.;
       replace sm5_`v'=(3/6)*`v' + (2/6)*`v'[_n+1] + (1/6)*`v'[_n+2]
                       if `v'[_n-1]==.;
     };
     
     label var sm5_ex3_dent1 "{stSerif:NS Denials: Stricter}";
     label var sm5_ex3_dent2 "{stSerif:NS Denials: Less strict}";
     label var sm5_ex3_all "{stSerif:51 programs}";
    
     graph set window fontface stSerif;
     line sm5_ex3_dent1 sm5_ex3_dent2 sm5_ex3_all year_month,
          xtitle("{stSerif:Base month}") ytitle("{stSerif:Monthly job-finding rate}")
          ylabel(0.15(.05).35)
          lc(black black green)
          xlabel(708(12)743, format(%tmCCYY) notick) xtick(708(3)749, add)
          legend(cols(2)rows(2))
          saving(fig2, replace);

    Comment


    • #3
      See the manual entry of graph set. Depending on your operating system, you need to be specific as

      graph set window fontface stSerif
      won't do it. serif is a class of fonts, not a font in itself. For Windows,

      SMCL {stSerif}
      implies

      Code:
      graph set window fontface "Times New Roman"

      Comment


      • #4
        That worked! Many thanks

        Comment

        Working...
        X