魅力的ではないかもしれません。分割変数とp値の名前を表示する場合は、mainlab
引数をnode_barplot
に微調整する方が良いでしょう。 Ctree classification with weights - results displayedへの答えには、タイトルに重みを含める方法があります。同様の方法で、変数とp値の分割を表示することもできます。
サブパネルが2つある新しいパネル機能を設定する場合は、grid
プログラミング(plot()
メソッドの基になっているグラフィックスシステム)が少し必要です。 grid.layout
を設定し、結果としてviewport
を実行する必要があります。
あなたが行うことができたパネル機能付き
make_inner_and_barplot <- function(object, ...) {
function(node) {
## layout
pushViewport(viewport(layout = grid.layout(nrow = 2, ncol = 1,
heights = unit(c(0.2, 0.8), "npc"))))
## background color
grid.rect(gp = gpar(fill = "white", col = 0))
## circle
pushViewport(viewport(layout.pos.col = 1, layout.pos.row = 1))
node_inner(object)(node)
popViewport()
## circle
pushViewport(viewport(layout.pos.col = 1, layout.pos.row = 2))
node_barplot(object, id = FALSE, ...)(node)
popViewport(2)
}
}
:?。このような
ct <- ctree(factor(cyl) ~ ., data = mtcars, minsplit = 2)
plot(ct, inner_panel = make_inner_and_barplot(ct), tnex = 0.8)
を 'CT < - ctree(因子(CYL)〜、データ= mtcars、minsplit = 2)。 plot(ct、inner_panel = node_barplot(ct)) ' – rawr
これは、node_barplotの表示を外すだけでプロットされたものです。私はnode_innerとnode_barplotの両方に1つずつ参加しようとしていました。 – Bakaburg