Skip to content

Trouble showing subset of data #24

@pgcudahy

Description

@pgcudahy

I've got a phylogeny that I'd like to annotate but am having issues. The annotation data is in the form of

image

This code works:

p <- ggtree(Taiwan_MKansasii_raxml_ng_outgroup_rooted, layout="circular")

p <- rotate_tree(p, 90)

p + geom_fruit(data=annotate_df,
                geom=geom_tile,
                mapping=aes(y=tip_label, x=name, fill=value),
                  color = "grey50", offset = 0.04,size = 0.02,
    axis.params=list(axis="x",
                     text.angle = 0,
                     text.size = 4,
                     line.size = 0,
                     hjust = -.2,
                     title = "",
                     title.height = 0.1,
                     title.size = 4))

which produces
image

But I think the image is too busy and only want to focus on the value of "WGY", so I changed the data argument to annotate_df %>% filter(name == "WGY")

p <- ggtree(Taiwan_MKansasii_raxml_ng_outgroup_rooted, layout="circular")

p <- rotate_tree(p, 90)

p + geom_fruit(data=annotate_df %>% filter(name  ==  "WGY"),
                geom=geom_tile,
                mapping=aes(y=tip_label, x=name, fill=value),
                  color = "grey50", offset = 0.04,size = 0.02,
    axis.params=list(axis="x",
                     text.angle = 0,
                     text.size = 4,
                     line.size = 0,
                     hjust = -.2,
                     title = "",
                     title.height = 0.1,
                     title.size = 4))

But that throws a bunch of errors

Warning message in max(abs(dat[[paste0("new_", xid)]]), na.rm = TRUE):
“no non-missing arguments to max; returning -Inf”
Warning message in min(x):
“no non-missing arguments to min; returning Inf”
Warning message in max(x):
“no non-missing arguments to max; returning -Inf”
Warning message in min(diff(sort(x))):
“no non-missing arguments to min; returning Inf”
Warning message:
“Removed 217 rows containing missing values (geom_tile).”
Warning message:
“Removed 4 rows containing missing values (geom_segment).”
Warning message:
“Removed 1 rows containing missing values (geom_text).”
Warning message:
“Removed 1 rows containing missing values (geom_text).”

How can I just get one circle of tiles showing the value of "WGY" and ignore the other 4 values of the "name" column in my dataframe?

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