title: R ggplot2: How do I avoid title and axis labels being cut off in PDF?
body: <p>I'm having some difficulty getting the PDF version of my plot to show the title and axis labels. They show up fine in the RStudio plot window, but get cut off in the PDF. I've tried a few things, including different margin settings, the pdf() function with dev.off() but keep getting the same result no matter what I try. Any ideas where I'm going wrong?</p>
  
  <pre><code>library(ggplot2)
  
  #Plot
  par(mar=c(6, 6, 6, 2))
  ggplot(data = paymentsNY, aes(x = Average.Covered.Charges/1000, y = 
  Average.Total.Payments/1000, alpha = 0.25))+ 
  geom_point()+
  xlab("Mean covered charges ($'000s)")+
  ylab("Mean total payments ($'000s)")+
  ggtitle("Mean covered charges and mean total payments - NY")+
  theme(title = element_text((size = 16)))+
  theme(legend.position = "none")+
  geom_smooth(method = "lm")
  
  #Write plot as PDF
  ggsave("payments_NY.pdf")
  </code></pre>
  
  <p>Thanks</p>