2011-12-15 75 views
6

列我在gplots使用textplot()寫在data.frame一些文本的PDF設備(使用PerformanceAnalytics版本也試過)。我看齊()選項是默認的,除了我更改字體/利潤率(CM是我在我的網站的個人資料中定義的家庭)被留下左對齊使用textplot(gplots或PerformanceAnalytics)

par(family = "CM" , omi = rep(.5 , 4)) 

我試圖讓「暗算」列有道理的。這是我失敗的嘗試......注意到

textplot(tableOfContents , show.rownames = FALSE , show.colnames = TRUE , hadj = 0) 

enter image description here

右對齊的作品就好了文字重疊:

textplot(tableOfContents , show.rownames = FALSE , show.colnames = TRUE , hadj = 1) 

enter image description here




編輯 如果別人與在texplot對準掙扎,我建議看看這個修改後的版本,我寫道: https://gist.github.com/1487363


EDIT2
你可能想刪除我的CEX = 1點的修復。在閱讀更多內容之後,我瞭解到函數參數中的cex應該應用於par(cex),我認爲這是令人困惑和過度工程的,但似乎是R標準練習

回答

7

查看源代碼,認爲最好的辦法是有輕微的修改,使x位置相適應,而不是保持恆定hadj。向開發者提出這種改變也許是值得的。這裏是一個要點,您可以下載修改後的版本:

https://gist.github.com/1482973

然後只需用source()來源它R,你應該能夠使用的功能像正常。

source('textplot.R') 
n = 10 
data = data.frame(Section=1:n, Plot=replicate(n, paste(LETTERS[sample(26, sample(20), replace=T)], collapse='')), Page=sort(rep(1:4, len=n)), stringsAsFactors=FALSE) 

textplot(data, show.rownames = FALSE, show.colnames = TRUE, hadj=0) 

enter image description here

+0

有病!非常感謝這一次的努力。當等待期到期時,我會開始獎金,這樣你可以獲得更多積分。此外,將向開發者建議此更新 – SFun28 2011-12-15 21:45:45