Rstudio does not print plots


I am trying to print my plots in Rstudio in high resolution for a journal publication.
I used to previously use TinnR to send commands to R and while the printing of high resolution plots was not a problem I could not run several lines at once, making it very laborious.
with Rstudio it seems the reverse.

Here the code I use to print

dpi=1000 #pixels per square inch
tiff("CORR.fig.2.tiff", width=10.2dpi, height=10dpi, res=dpi)

-then I create my plot -

I have tried with several functions, but it still does not print. Any ideas?

tiff works by writing the current plot file to a specified filename with the additional arguments given in your example, so the workflow is something along the lines of

  1. set dpi once or make it a variable
  2. prepare to write the next plot to a tiff file
  3. plot it

as you are now doing.

The next step is to make a function for these steps and apply it successively to a list of arguments. We'll use the built-in mtcars dataset, with the same resolution for all.

``` r
dpi = 100 #pixels per square inch (instead 1000, for convenience)

plotnames <- c("plot1.tiff","plot2.tiff","plot3.tiff","plot4.tiff","plot5.tiff")

make_tiff <- function(x) dev.print(tiff,file = plotnames[x-2], width=10.2*dpi, height=10*dpi, res=dpi)

make_plot <- function(x) plot(mtcars$mpg,mtcars[,x])

for(i in 3:7){

thanks for your answer.
I am afraid I do not understand the second part. could you guide me further what to do in my case ?
This is my plotting code (reduced, to make it more transparrent):

plot(ACET$Temp_UP,ACET$Salt_UP..M. ,ylim=c(0,5.2),col=c("black"), pch= 15,xlim= c(0,125))
points(SRB_S$Temp_UP,SRB_S$Salt_UP..M. ,ylim=c(0,5.2), pch= 1,col=c("black"), xlim= c(0,125))
points(METH$Temp_UP,METH$Salt_UP..M. ,ylim=c(0,5.2), pch= 17,col=c("black"), xlim= c(0,125))

Many thanks in advance!

If you need more specific help, please provide a proper REPRoducible EXample (reprex) illustrating your issue.