I am trying to create a dendrogram from similarity scores I have acquired not through hclust or any other means. I have two branches and just want to draw them out according to how similar they are and then have them branch off.
A and B are 0.5 similar A is 0.2 unique B is 0.3 unique
So the total height of A is 0.7 and the total height of B is 0.8, where 0.5 of their branches are shared.
The following just makes two branches without a long branch connecting the two leaves. There is this similar question, but it doesn't quite help!
x <- list(1, 2)
## attach "leaf" and "label" attributes to leaf nodes
attr(x[[1]], "leaf") <- TRUE
attr(x[[2]], "leaf") <- TRUE
attr(x[[1]], "label") <- "A"
attr(x[[2]], "label") <- "B"
## set "height" attributes for all nodes
attr(x, "height") <- 1
attr(x[[1]], "height") <- (1-0.7)
attr(x[[2]], "height") <- (1-0.8)
## set "midpoints" attributes for all nodes
attr(x, "midpoint") <- 1
attr(x[[1]], "midpoint") <- 0.5
attr(x[[2]], "midpoint") <- 0.5
## set "members" attributes for all nodes
attr(x, "members") <- 2
attr(x[[1]], "members") <- 1
attr(x[[2]], "members") <- 1
## set class as "dendrogram"
class(x) <- "dendrogram"
x
plot(x)