2013-10-28 15 views
0

我想改變上面提到的圖表中的一些參數。具體而言,我想做到以下幾點:chart.CumReturns(Perf。Analytics)的圖表參數

  1. 使得軸標籤和ylab小
  2. 刪除標題和騰出的空間用於圖表
  3. 對準ylabels水平,而不是垂直

我的代碼如下

opar <- par(oma = c(0.1,0.2,0,0.1)) 
par(mar=c(0,0,0,0),plt=c(0,0.1,0,0.1),mgp=c(3,0.5,0),pin=c(1,1),fin=c(0.2,0.2), 
    las=1,mex=0.5,cex.main=0.6,cex.lab=0.3,cex.axis=0.3) 
chart.CumReturns(returns_ts,geometric=TRUE,wealth.index=TRUE,main="",xlab="",col=hblue,cex.axis=0.8,cex.lab=0.6,las=1) 
par(xpd=NA) 
legend(legend=paste(paste(c("Performance indexiert"),strats[i])),cex=0.7, col=hblue,lty=1, lwd=2, bty="n", 
text.col="black", ncol=1, "bottom", inset = c(0.0, -.20)) 
text_note=c(paste("Quelle: Bloomberg,", "letzter Datenpunkt:", last(data$date))) 
mtext(text_note ,cex=0.4,col=hgrey,side = 1, line = 4, outer = FALSE,padj=0,adj=1)                                  #ensures that the text is shown at the                                                     
grid.raster(pic,x=c(0.05),y=c(0.02),width=0.05,height=0.03) 

然而,什麼也沒有發生,即沒有的,參數被改變。我也試過

main=NULL 

然後,時間系列的名字出現了。

你能幫我嗎?

問候 安德烈亞斯

回答

0

修訂3241個修理在底層chart.TimeSeries功能的一個錯誤;它已經錯誤地將cex.maincex.lab傳遞給title函數。感謝您指出了這一點。如果你想從那裏加載它,開發代碼在r-forge上。

更一般地說,這些圖表很好地不使用par。具體而言,使用par()直接更改圖表屬性將不起作用。我意識到這是不正確的,我一直有意義修復它幾年,但總是有別的事情要做...

所以最好的方式來傳遞你想要的屬性是直接通過功能。如果你想擺脫標題,請使用main=""。通過las也是一個最近的修復,所以它適用於我。這裏有一個可重複的例子:

library(PerformanceAnalytics) 
data(managers) 
par(mar=c(1,4,4,2)) # c(bottom, left, top, right) 
chart.CumReturns(managers[,1:3],geometric=TRUE,wealth.index=TRUE,main="",xlab="",col=bluefocus,cex.axis=0.8,cex.lab=0.6,las=1) 
par(xpd=NA) 
legend(legend=paste(paste(c("Performance indexiert"),"1")),cex=0.7, col=bluefocus,lty=1, lwd=2, bty="n", 
text.col="black", ncol=1, "bottom", inset = c(0.0, -.20)) 
text_note=c(paste("Quelle: Bloomberg,", "letzter Datenpunkt:", "last(data$date)")) 
mtext(text_note ,cex=0.4,col="grey",side = 1, line = 4, outer = FALSE,padj=0,adj=1) 

修改後,應該按照您的預期工作。對不起,麻煩,讓我知道,如果你看到任何其他錯誤。

pcc

+0

感謝您的支持。我將如何最好地利用你的修復?創建一個新的功能或覆蓋您的原始功能?這將如何工作?我的另一個問題是,似乎無法在PerformanceSummary圖表的條形圖中繪製多個系列。如果可以的話,那將很棒。安德烈亞斯 – user2157086