How to improve jagged line graph in ggplot2?

前端 未结 4 1696
無奈伤痛
無奈伤痛 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:26

    As others have mentioned, a vector-based image format like PDF or SVG might be the best way to go. If you want to use a bitmap, like PNG, then you can increase the resolution of your image with the res option of png().

    png("myplot.png", width = 1800, height = 1800, res = 600)

    This will produce a 3 inch by 3 inch image (in real-world dimensions) at 600 dpi. In my experience, the file size was still reasonable for relatively simple graphs.

    See this blog post for more ideas on how to improve your images:

    http://blog.revolutionanalytics.com/2009/01/10-tips-for-making-your-r-graphics-look-their-best.html

提交回复
热议问题