quantmod:chart_Series的边距太大

时间:2019-07-11 04:35:40

标签: pdf quantmod margins

试图获取8行的4个图表的pdf。

# R --silent --vanilla < s.r
suppressWarnings(suppressMessages(library(quantmod)))
options("getSymbols.warning4.0"=FALSE)
options("getSymbols.yahoo.warning"=FALSE)

getSymbols(c("BMY", "PFE", "MRK", "LLY"), source = "yahoo")
getSymbols("ABBV", source = "yahoo")

# set margins to 0, rfunction.com/archives/1302
lilpars <- chart_pars()
lilpars$cex=0.55
lilpars$mar=c(0,0,0,0) #lilpars$mar=c(3,1,1,1)

pdf(file = "s.pdf")
par(mfrow=c(8,4)) # 8 rows, 4 cols
chart_Series(BMY, name="BMY: Bristol", pars=lilpars)
chart_Series(PFE, name="PFE: Pfizer", pars=lilpars)
chart_Series(MRK, name="MRK: Merck", pars=lilpars)
chart_Series(LLY, name="LLY: EliLily", pars=lilpars)
chart_Series(LLY, name="ABBV: AbbVie", pars=lilpars)
dev.off()

错误消息是“数字页边距太大”,因此我尝试将页边距设置为零。我显然丢失了一些东西。

$ R --silent --vanilla < s.r
> # R --silent --vanilla < s.r
> suppressWarnings(suppressMessages(library(quantmod)))
> options("getSymbols.warning4.0"=FALSE)
> options("getSymbols.yahoo.warning"=FALSE)
> 
> getSymbols(c("BMY", "PFE", "MRK", "LLY"), source = "yahoo")
[1] "BMY" "PFE" "MRK" "LLY"
> getSymbols("ABBV", source = "yahoo")
[1] "ABBV"
> 
> # set margins to 0, rfunction.com/archives/1302
> lilpars <- chart_pars()
> lilpars$cex=0.55
> lilpars$mar=c(0,0,0,0) #lilpars$mar=c(3,1,1,1)
> 
> pdf(file = "s.pdf")
> par(mfrow=c(8,4)) # 8 rows, 4 cols
> chart_Series(BMY, name="BMY: Bristol", pars=lilpars)
Error in plot.new() : figure margins too large
Calls: <Anonymous> -> print.replot -> plot -> plot.replot -> plot.new
Execution halted

0 个答案:

没有答案