How to improve jagged line graph in ggplot2?

前端 未结 4 1691
無奈伤痛
無奈伤痛 2021-02-14 10:57

Is their any process to improve jagged lines produced by geom_line() joining multiple points into smooth presentable lines in ggplot2?

     lai.se <- structu         


        
4条回答
  •  执念已碎
    2021-02-14 11:29

    Output your graph to a file stored in a vector format, such as PDF or PostScript, and then use ImageMagick or similar to render that vector image to a bitmap (PNG, JPEG, etc.) at high resolution (150, 300 or even 600 dpi):

    $ convert myGraphAsVector.pdf -density 300 myGraphAs300DpiBitmap.png
    

    The file size will be large (and get increasingly larger as you increase the resolution of the final product), but the jaggedness of the bitmap will appear to go away at higher pixel densities.

提交回复
热议问题