Skip to content

geom_inset() does not work with layout_dendrogram() #635

Open
@gernat

Description

@gernat

Prerequisites

  • Have you read Feedback and follow the guide?
    • make sure your are using the latest release version
    • read the documents
    • google your question/issue

Describe you issue

  • Make a reproducible example (e.g. 1)
  • your code should contain comments to describe the problem (e.g. what expected and actually happened?)

Ask in right place

  • for bugs or feature requests, post here (github issue)
  • for questions, please post to google group

Many thanks for developing and maintaining such a useful package! When I try to plot pie charts on top of the nodes of a dendrogram, only one chart is shown. Something similar also happens when I use scale_x_reverse() or scale_y_reverse(), but with coord_flip() I get the expected result.

MRE:

# create a random tree with 5 nodes
library(ggtree)
set.seed(1)
tree <- rtree(3)

# create a pie chart for each node
data <- data.frame(node = 1:5, a = sample(1:100, 5), b = sample(1:100, 5))
pies <- nodepie(data, cols = c("a", "b"))

# Should show a the tree with 5 pie charts, but only one chart is displayed. 
# Works as expected if layout_dendrogram() is removed
ggtree(tree) + layout_dendrogram() + geom_inset(pies)

Result:
ggtree

Any advice on how to deal with this would be great!

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