ggplotでいい感じのサイズでファイルを出力する
ggplotでいい感じのサイズでファイルを出力する
DeLuciatoRライブラリを使う
もともとのfigureに縦横比に合わせて、max widthとmax heightの範囲内にfitしてくれる
PDFもそれ以外もOK
code:R
library("DeLuciatoR")
ggsave_fitmax(
filename="figure.pdf",
plot=fig,
maxwidth=10,
maxheight=10,
device=cairo_pdf
)
インストール方法
code:R
# install.packages("remotes")
# devtoolsは依存関係が多いらしいのでremotesパッケージを使う
# なければインストールする
remotes::install_github("infotroph/DeLuciatoR")
R
PDF
ggsave
public