title: Why does the tiff output look different than the ggplot2 output in R studio?
body: <p>I am making publication quality plots using ggplot2 in the latest version of R studio. </p>
  
  <p>They need to be saved as TIFFs at 300 dpi. </p>
  
  <p>When I run the code and call for the plot in the command console it appears perfectly in the plot window. However, when I save it as a tiff with width, height and resolution commands it looks completely screwy when I open the tiff in an image viewer. Font is huge, legend is huge and misplaced etc. </p>
  
  <p>I have tried to export the image from the R studio plot window but I only have options for height and width. Because I want a figure at 300 dpi that will be 3.5 x 2.33 I understand that the width: height will be 1050:699 (pixels). However, maybe I am misinterpreting this entry.</p>
  
  <p>Perhaps, I should enter height and width in inches. If I do, how then do I specify dpi? </p>
  
  <p>I have saved my plot using the tiff commands. Here is a reproducible example borrowed from Cookbooks forR</p>
  
  <pre><code>set.seed(955)
  dat &lt;- data.frame(cond = rep(c("A", "B"), each=10),
                xvar = 1:20 + rnorm(20,sd=3),
                yvar = 1:20 + rnorm(20,sd=3))
  
  library(ggplot2)
  test &lt;- ggplot(dat, aes(x=xvar, y=yvar, color=cond)) + 
       geom_point(shape=1) +
       scale_colour_hue(l=50) + # Use a slightly darker palette than normal
       geom_smooth(method=lm,   # Add linear regression lines
            se=FALSE) +
      theme(legend.position=c(.75,.38),
      axis.title.y = element_text(colour="black", size = 18), 
      axis.title.x = element_text( colour="black", size = 18),
      axis.text.x=element_text(colour="black", size= 16), 
      axis.text.y=element_text( colour="black", size = 16), 
      plot.title=element_text(size=14), # changing size of plot title)+
      legend.text=element_text( size=16))
  
  tiff("test.tiff", width= 1050, height= 699, units="px", res=300)
  
  plot(test)
  dev.off()
  </code></pre>
  
  <p>When I open it using Preview it looks completely screwy. I want it to look exactly as it does in the plot window but saved at a certain dpi. What am I doing wrong? What am I misunderstanding? </p>
  
  <p>Thanks!</p>