Closed
Description
I would like to propose the implementation of geom_dl/geom_label_repel in plotly because I am unable to convert my ggplots with these geoms to plotly.
I provide a sample data and code to illustrate this:
##sample data
library("ggrepel")
library(directlabels)
library(ggplot2)
library(plotly)
library(zoib)
library(dplyr)
data("GasolineYield", package = "zoib")
re.md <- zoib(yield ~ temp | 1 | 1, data=GasolineYield,
joint = FALSE, random=1, EUID=GasolineYield$batch,
zero.inflation = FALSE, one.inflation = FALSE,
n.iter=3200, n.thin=15, n.burn=200)
pred <- pred.zoib(re.md, data.frame(temp = seq(100, 600, 0.01)))
df<- data.frame(temp = seq(100, 600, 0.01),
pred$summary)
df$n<-sample(1:2, 50001, replace=TRUE)
df<- subset(df, select=c("temp", "n", "mean"))
df<-df %>%
mutate(mean = case_when
(n == 1 ~ df$mean/2,
n == 2 ~ df$mean))
colnames(df)[2] <- "group"
df$group<-as.factor(df$group)
##using geom_dl/geom_label_repel with ggplot2
pp<-ggplot() +
geom_line(data = df, aes(y = mean, x = temp,
group = group,
colour = group)) +
geom_dl(data=df, aes(y = mean, x = temp, label = group),
method = list(dl.combine("first.points", "last.points"),
cex = 0.8)) +
xlim(200, 600) +
theme_classic()
pp
geom_dl/geom_label_repel not working with ggplotly
ggplotly(pp)
Warning message:
In geom2trace.default(dots[[1L]][[1L]], dots[[2L]][[1L]], dots[[3L]][[1L]]) :
geom_GeomDl() 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
Metadata
Metadata
Assignees
Labels
No labels