Skip to content

ggplotly conversion of dendextend ggplot #807

Closed
@jrowen

Description

@jrowen

I noticed a few differences when converting a ggplot created via dendextend to a plotly plot. The text alignment is lost (should remain to the right of the marker) and the legend re-appears.

library(ggplot2)
library(plotly)
library(dendextend)

dend <- iris[1:30,-5] %>% dist %>% hclust %>% as.dendrogram %>%
  set("branches_k_color", k=3) %>% set("branches_lwd", c(1.5,1,1.5)) %>%
  set("branches_lty", c(1,1,3,1,1,2)) %>%
  set("labels_colors") %>% set("labels_cex", c(.9,1.2)) %>% 
  set("nodes_pch", 19) %>% set("nodes_col", c("orange", "black", "plum", NA))

ggd1 <- as.ggdend(dend)

p = ggplot(ggd1, horiz = TRUE, theme = NULL)
p

ggplotly(p)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions