I have a little problem with RStudio and the automatic export options. I have a big script which creates a lot of plots and I use the following code for this.
for(i in 1:2){
if(i == 1)
pdf(file="/home/steffen/Downloads/test.pdf",width=12,height=8)![enter image description here][1]
plot(1:3);
if(i == 1)
dev.off()
}
This works quite well, but I have to use the plots in Microsoft Word and Word does not really like to include PDFs ... so it would be great if I could create pngs instead. I tried 'convert' command in linux but the result is that die pdf which is about 20kb is afterwords about 1MB as png and the quality is not as expected. My script is the following:
for i in "$@"; do
dst="${i%pdf}png"
convert -density 1000x1000 -resize 3000x3000 -quality 95 "$i" "./png/$dst"
done
So does anyone have a good idea how to create a png which is not so large but has a good quality.
Either directly with RStudio or afterwords a conversation an automatic conversation.