Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/r/76.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
R Can';t在bookdown中插入绘图_R_Latex_Pandoc_Bookdown_Blogdown - Fatal编程技术网

R Can';t在bookdown中插入绘图

R Can';t在bookdown中插入绘图,r,latex,pandoc,bookdown,blogdown,R,Latex,Pandoc,Bookdown,Blogdown,我正在使用bookdown为R生成注释。显示错误的最小bookdown示例: 在我尝试添加绘图(dataviz.Rmd)之前,一切都很顺利。在构建该书时,我遇到以下错误: ! LaTeX Error: File `dataviz_files/figure-latex/plotxyx-1' not found. Error: Failed to compile rclassnotes.tex. See rclassnotes.log for more info. In addition: Wa

我正在使用bookdown为R生成注释。显示错误的最小bookdown示例:

在我尝试添加绘图(dataviz.Rmd)之前,一切都很顺利。在构建该书时,我遇到以下错误:

! LaTeX Error: File `dataviz_files/figure-latex/plotxyx-1' not found.

Error: Failed to compile rclassnotes.tex. See rclassnotes.log for more info.
In addition: Warning message:
In parse_packages(logfile, quiet = c(TRUE, FALSE, FALSE)) :
  Failed to find a package that contains dataviz_files/figure-latex/plotxyx-1
Execution halted

Exited with status 1.
我在以下条件下运行了此操作:

> sessionInfo()
R version 3.4.4 (2018-03-15)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS High Sierra 10.13.4

Matrix products: default
BLAS: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/3.4/Resources/lib/libRlapack.dylib

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

loaded via a namespace (and not attached):
 [1] compiler_3.4.4  backports_1.1.2 bookdown_0.7    magrittr_1.5    rprojroot_1.3-2 htmltools_0.3.6 tools_3.4.4    
 [8] yaml_2.1.18     Rcpp_0.12.16    stringi_1.1.7   rmarkdown_1.9   knitr_1.20      xfun_0.1        stringr_1.3.0  
[15] digest_0.6.15   evaluate_0.10.1
你有什么想法吗

编辑:

这似乎非常类似于: 和

注意我在Windows和Mac OSX上都有这个问题。我不认为这是其中一个组件的简单软件安装错误


这些文件似乎是在_bookdown_files/dataviz_files/figure latex/中创建的,暂时是在_dataviz_files/figure latex/

中创建的。问题是因为您在
\u common.R
中将图形设备设置为
svg


LaTeX本机不支持SVG图像(至少目前是这样)。您必须使用特殊的LaTeX软件包,或者使用LaTeX可以识别的图像格式,例如
pdf
png

这些文件是创建的吗?是的,但它们似乎已被删除/清理。我可以在那里看到它们,直到错误发生。旁注:如果我使用RStudio针织按钮,一切正常。但是构建手册中的错误,需要查看很多代码。你能试着构建一个最小的示例来演示这个问题吗?@RalfStubner将顶部的链接更新为一个最小的bookdown示例。这就成功了。感谢您的帮助和精彩的套餐。首先感谢您:)
knitr::opts_chunk$set(
  comment = "#>",
  collapse = TRUE,
  cache = FALSE,
  out.width = "70%",
  fig.align = 'center',
  fig.width = 6,
  fig.asp = 0.618,  # 1 / phi
  fig.show = "hold",
  dev = "svg"
)