Problem:
R的圖形輸出其畫質會變得不是很清晰等問題.
Analysis:
R中可以採用多種不同輸出格式, 其中以 pdf 格式較佳, 如果 tiff , eps 有做參數調整, 應該也是不錯的選擇, 詳細設定參考 ?tiff , ?pdf 指令。在 RStudio 軟體中亦可直接選取 Export \ Save Plot as Image ... 輸出圖檔, 參考以下 R codes.
graphics-export.R
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# title: graphics export | |
# date: 2013.5.24 | |
# author: Ming-Chang Lee | |
# install.packages("openair") | |
library(openair) | |
pdf("openair.pdf") | |
polarFreq(mydata, pollutant = "so2", type = "year", statistic = "weighted.mean", min.bin = 2) | |
dev.off() | |
png("openair.png", width = 1024, height = 768) | |
polarFreq(mydata, pollutant = "so2", type = "year", statistic = "weighted.mean", min.bin = 2) | |
dev.off() | |
tiff("openair.tiff", width = 1024, height = 768) | |
polarFreq(mydata, pollutant = "so2", type = "year", statistic = "weighted.mean", min.bin = 2) | |
dev.off() | |
setEPS() | |
postscript("openair.eps") | |
polarFreq(mydata, pollutant = "so2", type = "year", statistic = "weighted.mean", min.bin = 2) | |
dev.off() | |
# end |
pdf原圖

pdf 放大200%
