Skip to content

gheatmap error #670

@JakoboEU

Description

@JakoboEU

Minimal example

library(ggtree)
library(ggplot2)

set.seed(1)
tree <- rtree(5)
p <- ggtree(tree)

mat <- data.frame(
  pred1 = c(1, -1, 1, 0, -1),
  pred2 = c(-1, -1, 1, 1, 0)
)
rownames(mat) <- tree$tip.label

gheatmap(p, mat)
> packageVersion("ggplot2")
[1] ‘4.0.0’
> packageVersion("ggtree")
[1] ‘3.16.3’
> rownames(predictor_matrix)
[1] "t3" "t2" "t5" "t4" "t1"
> tree$tip.label
[1] "t2" "t1" "t3" "t4" "t5"

Note warning (this is mentioned in issue #656 )

> p <- ggtree(tree)
Warning messages:
1: `aes_()` was deprecated in ggplot2 3.0.0.
ℹ Please use tidy evaluation idioms with `aes()`
ℹ The deprecated feature was likely used in the ggtree package.
  Please report the issue at <https://github.com/YuLab-SMU/ggtree/issues>.
This warning is displayed once every 8 hours.
Call `lifecycle::last_lifecycle_warnings()` to see where this warning was generated. 
2: In fortify(data, ...) :
  Arguments in `...` must be used.
✖ Problematic arguments:
• as.Date = as.Date
• yscale_mapping = yscale_mapping
• hang = hang
ℹ Did you misspell an argument name?

Then gheatmap gives the following error

> gheatmap(p, mat)
Error in `stat_tree()`:
! Problem while computing aesthetics.
ℹ Error occurred in the 1st layer.
Caused by error in `check_aesthetics()`:
! Aesthetics must be either length 1 or the same as the data (9).
✖ Fix the following mappings: `from`, `to`, and `.panel`.
Run `rlang::last_trace()` to see where the error occurred.

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