title: Changing fonts in ggplot2
body: <p>Once upon a time, I changed my <code>ggplot2</code> font using <code>windowsFonts(Times=windowsFont(&quot;TT Times New Roman&quot;))</code>. Now, I can't get it off of this.</p>
  <p>In trying to set <code>family=&quot;&quot;</code> in <code>ggplot2</code> <code>theme()</code>, I can't seem to generate a change in fonts as I compile the MWE below with different font families.</p>
  <pre><code>library(ggplot2)
  library(extrafont)
  loadfonts(device = &quot;win&quot;)
  
  a &lt;- ggplot(mtcars, aes(x=wt, y=mpg)) + geom_point() +
          ggtitle(&quot;Fuel Efficiency of 32 Cars&quot;) +
          xlab(&quot;Weight (x1000 lb)&quot;) + ylab(&quot;Miles per Gallon&quot;) +
          theme(text=element_text(size=16, 
  #       family=&quot;Comic Sans MS&quot;))
  #       family=&quot;CM Roman&quot;))
  #       family=&quot;TT Times New Roman&quot;))
  #       family=&quot;Sans&quot;))
          family=&quot;Serif&quot;))
  
  
  print(a)
  print(&quot;Graph should have refreshed&quot;)
  </code></pre>
  <p>R is returning a warning <code>font family not found in Windows font database</code>, but there was a tutorial I was following (if I can find it again I will update the link here) that said this was normal and not a problem.  Also, somehow this worked at one point because my graph once used some arial or helvitica type font.  I think this has always been a present warning even during the initial times migration.</p>
  <p>UPDATE</p>
  <p>when I run <code>windowsFonts()</code> my output is</p>
  <blockquote>
  <p>$serif [1] &quot;TT Times New Roman&quot;</p>
  <p>$sans [1] &quot;TT Arial&quot;</p>
  <p>$mono [1] &quot;TT Courier New&quot;</p>
  </blockquote>
  <p>But, this is after I ran <code>font_import()</code> so I can only conclude that my fonts are not being saved in the right place.  The code that ran the <code>font_import()</code> request actually loads the libraries with:</p>
  <pre><code>LocalLibraryLocation &lt;- paste0(&quot;C:\\Users\\&quot;,Sys.getenv(&quot;USERNAME&quot;),&quot;\\Documents&quot;,&quot;\\R\\win-library\\3.2&quot;);
      .libPaths(c(LocalLibraryLocation, .libPaths()))
  </code></pre>