ggplotly_background {colorrepel} | R Documentation |
Prepare ggplot object to ggplotly-compatible layer and image layer
Description
Prepare ggplot object to ggplotly-compatible layer and image layer
Usage
ggplotly_background(
g,
repel_color = TRUE,
repel_label = TRUE,
encircle = FALSE,
mascarade = FALSE,
width = 5,
height = 5,
filename = "temp.png",
draw_box = NULL,
background = NULL,
background_alpha = 1,
use_cairo = FALSE,
label_lim = 0.05,
ggbuild = NULL,
crop = TRUE,
size_nudge = 0,
...
)
Arguments
g |
ggplot plot object |
repel_color |
whether to rearrange colors |
repel_label |
whether to add centroid labels with ggrepel |
encircle |
whether to draw geom_encircle by cluster |
mascarade |
use mascarade package to outline clusters |
width |
plot width |
height |
plot height |
filename |
temp file location for saving image |
draw_box |
if a colored background should be included |
background |
if specified, use this ggplot object or file as background instead |
background_alpha |
alpha value of background image |
use_cairo |
whether to use cairo for saving plots, maybe needed for certain ggplot extensions |
label_lim |
whether to limit labels to avoid edge fraction |
ggbuild |
already built ggplot_built object if available |
crop |
whether to call cropping of the background image to remove whitespace |
size_nudge |
slight image size adjustment, default to none |
... |
arguments passed to gg_color_repel |
Value
plotly object with background image of layers unsupported by plotly
Examples
a <- ggplot2::ggplot(ggplot2::mpg, ggplot2::aes(displ, hwy)) +
ggplot2::geom_point(ggplot2::aes(color = as.factor(cyl)))
new_colors <- color_repel(a)
b <- ggplotly_background(a, filename = NULL)