saving plots to pdf fails

前端 未结 2 2103
星月不相逢
星月不相逢 2021-01-26 13:45

When I use pdf(\"somefile.pdf\") to save my plots to a pdf file, everything seems to work. No error messages or whatsoever. Still the result is screwed (file size i

2条回答
  •  鱼传尺愫
    2021-01-26 14:09

    The pdf and png devices work a little different. The pdf device by default will put multiple plots into a single file, so it will not finalize the file until you tell it that you are finished creating the plots (with dev.off). The png device will put 1 plot in 1 file, so will create multiple files for multiple plots. So as soon as you start a second plot, the 1st file will be finalized and can be opened and used. You still need dev.off to finalize the last file after the last plot.

提交回复
热议问题