R babel调graph输出的图片的分辨率

默认画出来, 是这么个分辨率:

参考这个以后, 发现应该调png参数res. 可是R babel直接用的png函数, 没给参数. 有什么办法设定R babel的png这些的参数么?

这个问题虽然分辨率怎么调还是不知道, 但以另一种方式解决了, 用svg格式, 不用png

官网的documentation is all you need https://orgmode.org/worg/org-contrib/babel/languages/ob-doc-R.html

Graphics Header Arguments

There are many R-specific header arguments used to configure R graphics devices. They include:

width

the width of the graphics region, default value is 7 (inches) or 480 (pixels)

height

the height of the graphics region, default value is 7 (inches) or 480 (pixels)

units

the units in which width and height are given – px , in , cm , or mm . Note that the default units are set by the file type: in for pdf and ps, px for jpeg, bmp, png, tiff

bg

the background color defaults to “transparent”

fg

the foreground color defaults to “black”

pointsize

the default point size in the graphics defaults to 12

quality

the quality of a JPEG image as a percentage

compression

the type of compression to be used

res

the nominal resolution in pixels per inch

1 个赞

如果你的图片的数据点很多,导出为pdf或者html的时候建议别用svg,这会让内容的渲染特别慢。一般数据点超过几千个就最好用png。