| geom_edge_label | R Documentation | 
Label edges with corresponding split breaks
geom_edge_label(
  mapping = NULL,
  nudge_x = 0,
  nudge_y = 0,
  ids = NULL,
  shift = 0.5,
  label.size = 0,
  splitlevels = seq_len(100),
  max_length = NULL,
  parse_all = FALSE,
  parse = TRUE,
  ...
)
mapping | 
 Mapping of   | 
nudge_x, nudge_y | 
 Nudge label.  | 
ids | 
 Choose which splitbreaks to label by their children's ids.  | 
shift | 
 Value in (0,1). Moves label along corresponding edge.  | 
label.size | 
 See   | 
splitlevels | 
 Which levels of split to plot. This may be useful in the presence of many factor levels for one split break.  | 
max_length | 
 If provided breaks_label levels will be truncated to the specified length.  | 
parse_all | 
 Defaults to   | 
parse | 
 Needs to be true in order to parse inequality signs of breaks_label.  | 
... | 
 Additional arguments for   | 
ggparty()
library(ggparty)
data("WeatherPlay", package = "partykit")
sp_o <- partysplit(1L, index = 1:3)
sp_h <- partysplit(3L, breaks = 75)
sp_w <- partysplit(4L, index = 1:2)
pn <- partynode(1L, split = sp_o, kids = list(
  partynode(2L, split = sp_h, kids = list(
    partynode(3L, info = "yes"),
    partynode(4L, info = "no"))),
  partynode(5L, info = "yes"),
  partynode(6L, split = sp_w, kids = list(
    partynode(7L, info = "yes"),
    partynode(8L, info = "no")))))
py <- party(pn, WeatherPlay)
ggparty(py) +
  geom_edge() +
  geom_edge_label() +
  geom_node_label(aes(label = splitvar),
                  ids = "inner") +
  geom_node_label(aes(label = info),
                  ids = "terminal")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.