Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/image/5.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 从美人鱼导出为图像(甘特图)_R_Image_Diagrammer_Mermaid - Fatal编程技术网

R 从美人鱼导出为图像(甘特图)

R 从美人鱼导出为图像(甘特图),r,image,diagrammer,mermaid,R,Image,Diagrammer,Mermaid,我在尝试将甘特图导出为png或任何其他图像格式时遇到问题。RStudio中的查看器向我显示甘特图的渲染。它还提供了另存为图像的选项,但我发现放大时图像非常像素化 以下是我尝试过的,但运行后文件显示为空: library(DiagrammeR) m1<-mermaid(" gantt dateFormat MM/DD/YY title Example Gantt section Example Section Pr

我在尝试将甘特图导出为png或任何其他图像格式时遇到问题。RStudio中的查看器向我显示甘特图的渲染。它还提供了另存为图像的选项,但我发现放大时图像非常像素化

以下是我尝试过的,但运行后文件显示为空:

    library(DiagrammeR)
    m1<-mermaid("
      gantt
      dateFormat MM/DD/YY
      title Example Gantt

      section Example Section
      Process1 :done, task_1, 01/01/01, 01/05/01
      Process2 :done, task_2, 02/01/02, 02/05/02
      Process3 :done, task_3, 03/01/03, 03/05/03
    ")
    m1$x$config = list(ganttConfig = list(
      axisFormatter = list(list(
        "%y" 
        ,htmlwidgets::JS(
          'function(d){ return d.getDay() }' 
        )
      ))
    ))
    png("Example.png")
    m1
    dev.off()
库(图解程序)

m1这是从R控制台运行时执行
m1
对象所创建的代码。我在SO查看窗口中没有看到图像,但很抱歉,因为我不是该设备的专业用户。您可以在浏览器中查看这一点,这是RSudio提供的,它可以放大到浏览器限制,然后屏幕截图将不会被像素化:


{“x”:{“图表”:“\n甘特图\n日期格式MM/DD/YY\n标题示例甘特图\n\n节示例节\n过程1:done,task_1,01/01/01,01/05/01\n过程2:done,task_2,02/01/02,02/05/02\n过程3:done,task_3,03/01/03,03/05/03\n”,“配置”:{“甘特config”:{“axisFormatter”:[[%y”,“函数(d){return d.getDay()}“]]},“evals”:[“config.ganttConfig.axisFormatter.0.1”]}
{“查看器”:{“宽度”:450,“高度”:350,“填充”:15,“填充”:true},“浏览器”:{“宽度”:960,“高度”:500,“填充”:40,“填充”:false}

mermaid
不返回图像。它返回有关如何绘制图像的html说明。如果要以更高(缩放)分辨率保存,应先进行缩放,然后进行保存。