R ggplot, remove white margins in ggsave/ggplot

前端 未结 4 1169
孤街浪徒
孤街浪徒 2021-02-04 06:56

How can I remove the white margins in ggsave?

My question is exactly the same as Remove white space (i.e., margins) ggplot2 in R. However, the answer there isn\'t ideal

4条回答
  •  没有蜡笔的小新
    2021-02-04 07:22

    In this answer linking to this blog post there is a solution which also works for different aspect ratios. You can crop the image on your hard drive, independently of OS:

    knitr::plot_crop()
    

提交回复
热议问题