plotly / plotly/plotly.R

ggplotly not working when plotting circular ggtree

Open
#2,241 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
R
Stars
2.7k
Forks
641
PR merge metrics
No merged PRs in 30d

Description

Hello,

When I try to plot through ggplotly a graph generated through ggree with circular layout it results in a error.

Example code and error:

library(MicrobiotaProcess)
library(ggtree)

data(kostic2012crc)

taxa <- tax_table(kostic2012crc)
tree <- as.treedata(taxa, include.rownames=TRUE)

ggtree(tree, layout="circular", size=0.2) +
geom_tiplab(size=1) ->p

plotly::ggplotly(p)

ERROR:
Error in rng[[xy]]$get_labels() : attempt to apply non-function
In addition: Warning messages:
1: In min(z[["x"]]$dimension %()% z$x.range %||% z$x_range) :
no non-missing arguments to min; returning Inf
2: In max(z[["x"]]$dimension %()% z$x.range %||% z$x_range) :
no non-missing arguments to max; returning -Inf
3: In min(z[["y"]]$dimension %()% z$y.range %||% z$y_range) :
no non-missing arguments to min; returning Inf
4: In max(z[["y"]]$dimension %()% z$y.range %||% z$y_range) :
no non-missing arguments to max; returning -Inf
5: In geom2trace.default(dots[[1L]][[1L]], dots[[2L]][[1L]], dots[[3L]][[1L]]) :
geom_GeomTextGGtree() has yet to be implemented in plotly.
If you'd like to see this geom implemented,
Please open an issue with your example code at
https://github.com/ropensci/plotly/issues
6: In geom2trace.default(dots[[1L]][[1L]], dots[[2L]][[1L]], dots[[3L]][[1L]]) :
geom_GeomTextGGtree() has yet to be implemented in plotly.
If you'd like to see this geom implemented,
Please open an issue with your example code at
https://github.com/ropensci/plotly/issues

When I try with ggtree(tree, layout="dendrogram", size=0.2) +
geom_tiplab(size=1) ->p

plotly::ggplotly(p)

It works.

It seems that it does not like the circular format.

Any tips?

Thanks

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the reported example with plotly::ggplotly(), ggtree(tree, layout="circular"), and geom_tiplab(). Compare it with the working dendrogram layout and inspect the geom_GeomTextGGtree warning. Done means the circular plot converts without the reported error and warnings, while preserving the labels.

Written by the indexing model from the issue text.

Assessment

Tech stack
r
Domain
data-visualization
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.