# preview of v0.2.0
library(ggplot2)
library(plotly)
library(colorrepel)
# original data
a <- readRDS("umap_gg.rds")
# static image can be converted to interactive (hover-able) plot with plotly
ggplotly(a)
# color_repel plus text label
# normal static image
b <- gg_color_repel(a, repel_label = T, nudge_x = 2, nudge_y = 2, force = 10)
b
# PROBLEM:
# ggrepel texts are not supported by plotly
# new label text layer is lost in conversion
plotly::ggplotly(b)
# SOLUTION:
# move repel text to background layer
# now best of both worlds
ggplotly_background(a, alpha = 0.5)
# can move encircle geom to background layer too
ggplotly_background(a, repel_label = T, encircle = T)
# EXTEND TO OTHER CASES:
# other geoms not supported by plotly conversion, like ggtrace
b <- a + ggtrace::geom_point_trace(aes(x = UMAP_1, y = UMAP_2, fill = shortread_type), alpha = 0.2)
ggplotly(b)
# can also be displayed as background, without using any of colorepel's other functionalities
# anything in the same coordinates should be useable
ggplotly_background(a,
repel_color = F,
repel_label = F,
encircle = F,
background = b)