R-graph-gallery
R-graph-gallery copied to clipboard
update angles and hjust of vertices in Circular Dendrogram
What?
Update angles and hjust calculation for 339-circular-dendrogram-with-ggraph.Rmd
Why?
In the original version, the geom_node_text is hidden behind the node and not readable.
How?
I update the calculation for vertices$angle
and vertices$hjust
and added coord_flip()
method to the graph.
Testing?
There are no unit tests. However, after I made the changes, I re-knitted the Rmarkdown document and the circular dendrogram now displays as intended.
Screenshot
Original circular dendrogram
New circular dendrogram
Hi @PaulApivat, I've knitted my rmd and it works fine for me, so it's weird it does not for you. I've added a session.info() at the end of the document. Could you please have a look and tell me what's different for you?
Hi @holtzy , I get the same problem as @PaulApivat as well, except that his pull request also did not solve the problem. The problem arises because of the location of the starting point of the dendrogram i.e. the location of subgroup 1. Your angle calculation assumes that the location is at the top. For some reason, I get it at 90 degrees. The entire circle is rotated and hence the angle of the label text gets screwed up.