Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/svg/2.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 将svg对象保存到磁盘上_R_Svg - Fatal编程技术网

R 将svg对象保存到磁盘上

R 将svg对象保存到磁盘上,r,svg,R,Svg,我正在使用一个输出svg对象的函数。正如我看到的,SVG对象本质上是一个字符串。 我想知道怎么做 1) 绘制函数的svg输出 2) 是否将此svg对象保存到svg扩展下的磁盘?我试图保存,但只是导致了一个错误 我对svg处理相当陌生,因此希望您能提供任何信息。 谢谢 1)我尝试了我正在开发的软件包,但并不简单。最后,我需要两个库:rsvg和grImport2。以下是我使用的代码: tfile <- tempfile(fileext = ".svg") tfile2 <- te

我正在使用一个输出svg对象的函数。正如我看到的,SVG对象本质上是一个字符串。 我想知道怎么做 1) 绘制函数的svg输出 2) 是否将此svg对象保存到svg扩展下的磁盘?我试图保存,但只是导致了一个错误

我对svg处理相当陌生,因此希望您能提供任何信息。 谢谢

1)我尝试了我正在开发的软件包,但并不简单。最后,我需要两个库:
rsvg
grImport2
。以下是我使用的代码:

  tfile <- tempfile(fileext = ".svg")
  tfile2 <- tempfile(fileext = ".png")
  cat(svg_code, file=tfile)
  if (requireNamespace("rsvg", quietly = TRUE) && requireNamespace("grImport2", quietly = TRUE)) {
    rsvg::rsvg_svg(svg = tfile, tfile2)
    p <- grImport2::readPicture(tfile2)
    grImport2::grid.picture(p)
  } else {
    if (systemShow == FALSE && outFile == ''){
      warning("The figure cannot be rendered in the plot window. Please, use the arguments outFile and/or systemShow.")
    }
  }
  if (systemShow){
    utils::browseURL(tfile)
  }
tfile1)我尝试了我正在开发的一个包,但并不简单。最后,我需要两个库:
rsvg
grImport2
。以下是我使用的代码:

  tfile <- tempfile(fileext = ".svg")
  tfile2 <- tempfile(fileext = ".png")
  cat(svg_code, file=tfile)
  if (requireNamespace("rsvg", quietly = TRUE) && requireNamespace("grImport2", quietly = TRUE)) {
    rsvg::rsvg_svg(svg = tfile, tfile2)
    p <- grImport2::readPicture(tfile2)
    grImport2::grid.picture(p)
  } else {
    if (systemShow == FALSE && outFile == ''){
      warning("The figure cannot be rendered in the plot window. Please, use the arguments outFile and/or systemShow.")
    }
  }
  if (systemShow){
    utils::browseURL(tfile)
  }

t文件此软件包可能会有所帮助。您到底遇到了什么错误?如果您包含一个简单的示例输入,可以用来测试和验证可能的解决方案,那么就更容易为您提供帮助。这个包可能会有所帮助。您到底遇到了什么错误?如果您包含一个简单的示例输入,可以用来测试和验证可能的解决方案,那么就更容易帮助您。