Skip to content
Prev 361579 / 398502 Next

Tree plot with percentages and hierarchies

Hi Joonas,
It is easy to display hierarchic classification using either the
plot.dendrite or sizetree functions (plotrix). At the moment, they
will only display counts, not percentages. It would not be too
difficult to reprogram either one to display percentages. Here are
examples with shortened category names (you'll see why):

Level_0 = c("Action X", "Action X", "Action X", "Action X", "Action
X", "Action X", "Action X", "Action X", "Action X", "Action X",
"Action X", "Action X", "Action X", "Action X", "Action X", "Action
X", "Action X", "Action X", "Action X", "Action X")
Level_1 = c("R1", "R1", "R1", "R1", "R1", "R1", "R1", "R1", "R1",
"R1", "R2", "R2", "R2", "R2", "R2", "R2", "R2", "R2", "R2", "R2")
Level_2 = c("Subr11", "Subr11", "Subr11", "Subr11", "Subr12",
"Subr12", "Subr12", "Subr12", "Subr12", "Subr12", "Subr21", "Subr21",
"Subr21", "Subr21", "Subr21", "Subr21", "Subr21", "Subr21", "Subr22",
"Subr22")
Level_3 = c("Subsubr111", "Subsubr111", "Subsubr111", "Subsubr112",
"Subsubr121", "Subsubr121", "Subsubr121", "Subsubr121", "Subsubr121",
"Subsubr121", "Subsubr221", "Subsubr221", "Subsubr221", "Subsubr221",
"Subsubr221", "Subsubr221", "Subsubr221", "Subsubr221", "Subsubr222",
"Subsubr222")

Levels = data.frame(Level_0 = Level_0, Level_1 = Level_1, Level_2 =
Level_2, Level_3 = Level_3)

library(plotrix)
plot.dendrite(Levels)
sizetree(Levels)

Jim
On Thu, Jun 9, 2016 at 6:03 AM, Bert Gunter <bgunter.4567 at gmail.com> wrote: