說我有使用包party
一個巨大的決策樹,一個人如何申報自動調整大小以適應一切都變成JPEG或PNG?如何自動R中大小地塊
例子:
library(party)
data(Boston)
jpeg("test.jpg")
tree <- ctree(crim ~ zn + indus + chas + nox + rm + age + dis + rad + tax + ptratio + black, data = Boston)
plot(tree)
說我有使用包party
一個巨大的決策樹,一個人如何申報自動調整大小以適應一切都變成JPEG或PNG?如何自動R中大小地塊
例子:
library(party)
data(Boston)
jpeg("test.jpg")
tree <- ctree(crim ~ zn + indus + chas + nox + rm + age + dis + rad + tax + ptratio + black, data = Boston)
plot(tree)
所以我覺得在這裏你的問題是,你沒有得到輸出。原因是由於圖形設備的工作原理。你要打開的文件寫入,輸入您在文件中需要的數據,然後關閉圖形設備。
對於你想做什麼:
png("test.png", 1200, 600)
plot(tree)
dev.off()
的數字設置在像素PNG的寬度和高度。
編輯:如果你想讓它自動調整,我建議根據終端節點的數量對其進行修改:
png("test.png", 140*length(unique([email protected])), 600)
plot(tree)
dev.off()
沒有那不是我的問題,我 – chutsu 2012-07-29 13:05:48
編輯它,因爲我意識到這並沒有完全回答你的問題。我認爲現在情況會好一些。 – 2012-07-29 13:08:40
使用png格式,如果你要使用光柵格式。情節通常不保證壓縮。 – 2012-07-29 12:49:38