Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

geom_GeomGeneArrow() and geom_GeomFitText() has yet to be implemented in plotly [shapviz] #2149

Open
madprogramer opened this issue Jun 23, 2022 · 2 comments

Comments

@madprogramer
Copy link

@madprogramer madprogramer commented Jun 23, 2022

Recently I started working with the new shapviz package. In particular, the waterfall plot was working just fine for what I needed to visualise. Unfortunately, I was unable to use ggplotly to render the plots in plotly.

image

As it turns out, the waterfall plot is different from plotly's waterfall chart as it is built on the GeomGeneArrow geom from
from https://github.com/wilkox/gggenes.

Warning message in geom2trace.default(dots[[1L]][[1L]], dots[[2L]][[1L]], dots[[3L]][[1L]]):
“geom_GeomGeneArrow() 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](https://github.com/ropensci/plotly/issues)

In addition, geom_GeomFitText, which is needed for rendering text over plot elements is also unimplemented.

geom_GeomFitText() 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](https://github.com/ropensci/plotly/issues)

Reprex adapted from the default shapviz example below:

#library imports
install.packages("shapviz")
library(shapviz)
library(ggplot2)
library(xgboost)

set.seed(3653)

X <- diamonds[c("carat", "cut", "color", "clarity")]
dtrain <- xgb.DMatrix(data.matrix(X), label = diamonds$price)

fit <- xgb.train(
  params = list(learning_rate = 0.1, objective = "reg:squarederror"), 
  data = dtrain,
  nrounds = 65L
)

X_small <- X[sample(nrow(X), 2000L), ]

shp <- shapviz(fit, X_pred = data.matrix(X_small), X = X_small)
waterfall_plot <- sv_waterfall(shp, row_id = 1)

library(plotly)
ggplotly(waterfall_plot)

Expected Output should render similar to this (original ggplot):
image

@madprogramer madprogramer changed the title geom_GeomGeneArrow() and geom_fit_text() not implemented in plotly geom_GeomGeneArrow() and geom_GeomFitText() not implemented in plotly Jun 23, 2022
@madprogramer madprogramer changed the title geom_GeomGeneArrow() and geom_GeomFitText() not implemented in plotly geom_GeomGeneArrow() and geom_GeomFitText() has yet to be implemented in plotly Jun 23, 2022
@madprogramer madprogramer changed the title geom_GeomGeneArrow() and geom_GeomFitText() has yet to be implemented in plotly geom_GeomGeneArrow() and geom_GeomFitText() has yet to be implemented in plotly [shapviz] Jun 23, 2022
@madprogramer
Copy link
Author

@madprogramer madprogramer commented Jun 27, 2022

I would like to be assigned to this if possible :) @cpsievert

@mayer79
Copy link

@mayer79 mayer79 commented Jul 14, 2022

@madprogramer : Thanks for pushing this! I'd love to see these geoms available. The current release of "shapviz" at least plays well together with plotly regarding the dependence plot and the (new) default importance plot.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants