Custom graphical device in Sweave

北慕城南 提交于 2019-12-01 19:29:22

@user20650 kindly proposed me to convert the answer given in his/her comment to an official one.

It suffices to include the pdf file extension in the cairo_pdf function. Then replace the mycairo function with:

mycairo <- function(name, width = 7, height = 7, ...) { 
  grDevices::cairo_pdf(sprintf("%s.pdf", name), width = width, height = height)
}

As a side note, instead of specifying grdevice=mycairo in each figure chunk, you can also set it as a global option:

\SweaveOpts{grdevice=mycairo}
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!