-
Notifications
You must be signed in to change notification settings - Fork 183
Description
Dear YuLab-SMU
When I run code below
#--------------------------------
nwk <- system.file("extdata", "sample.nwk", package="treeio")
tree <- read.tree(nwk)
circ <- ggtree(tree, layout = "circular")
df <- data.frame(first=c("a", "b", "a", "c", "d", "d", "a",
"b", "e", "e", "f", "c", "f"),
second= c("z", "z", "z", "z", "y", "y",
"y", "y", "x", "x", "x", "a", "a"))
rownames(df) <- tree$tip.label
df2 <- as.data.frame(matrix(rnorm(39), ncol=3))
rownames(df2) <- tree$tip.label
colnames(df2) <- LETTERS[1:3]
p1 <- gheatmap(circ, df, offset=.8, width=.2,
colnames_angle=95, colnames_offset_y = .25) +
scale_fill_viridis_d(option="D", name="discrete\nvalue")
library(ggnewscale)
p2 <- p1 + new_scale_fill()
gheatmap(p2, df2, offset=15, width=.3,
colnames_angle=90, colnames_offset_y = .25) +
scale_fill_viridis_c(option="A", name="continuous\nvalue")
#--------------------------------------------------------------
Error: object properties are invalid:
- @mapping must be ggplot2::mapping, not S3<data.frame>
- stop(msg, call. = FALSE)
- validate(object)
- S7::
props<-(*tmp*, value =[[<-(S7::props(x), i, value)) $<-.ggplot2::gg(*tmp*, "mapping", value = structure(list(
from = structure(1:2, levels = c("first", "second"), class = "factor"),
to = c(62.4, 68), y = c(0, 0), .panel = structure(c(1L, 1L
), class = "factor", levels = "Tree")), row.names = c(1L, ...$<-(*tmp*, "mapping", value = structure(list(from = structure(1:2, levels = c("first",
"second"), class = "factor"), to = c(62.4, 68), y = c(0, 0),
.panel = structure(c(1L, 1L), class = "factor", levels = "Tree")), row.names = c(1L,
14L), class = "data.frame"))- ggplot_add.new_aes(object, p, objectname)
- ggplot_add(object, p, objectname)
- add_ggplot(e1, e2, e2name)
method(+, list(ggplot2::ggplot, class_any))(e1 = ,
e2 = structure("fill", class = "new_aes"), ...)- S7::S7_dispatch()
- base_ops[[.Generic]](e1, e2)
- doTryCatch(return(expr), name, parentenv, handler)
- tryCatchOne(expr, names, parentenv, handlers[[1L]])
- tryCatchList(expr, classes, parentenv, handlers)
- tryCatch(return(base_ops[[.Generic]](e1, e2)), S7_error_method_not_found = function(cnd) cnd)
- Ops.S7_object(p1, new_scale_fill())
Please help me fix problems.
Thank you so much.