plotly_annotation_rm: [!] Manage annotations in a 'plotly' object

Description Usage Arguments Value Author(s) See Also Examples

View source: R/plotly_annotation_rm.R

Description

Manage annotations of plotly object.

Usage

1
2
3
4
5
6
7

Arguments

obj

a plotly object (created with function plot_ly, ggplotly, subplot or similar).

which

Numeric vector with numbers of annotations to remove.

Value

The functions described here do the following actions to plotly object:

plotly_annotation_rm() removes annotations and returns updated plotly object;

plotly_annotation_n() returns the number of annotations in the object;

plotly_annotation_list() returns a list of annotation parameters;

plotly_annotation_text() returns a list with text of each annotation.

Author(s)

Vilmantas Gegzna

See Also

Other spPlot functions for plotly: label_expr2text(), plotly_modify_hover(), plotly_modify_legend(), plotly_tidy()

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
library(spPlot)
library(plotly)

# Create plotly object 'obj':
iris$Species2 <- sample(iris$Species)
p <- ggplot(iris, aes(x = Sepal.Length,
                         y = Sepal.Width))
obj <- subplot(p + geom_line(aes(color = Species)),
               p + geom_point(aes(shape = Species2)))

# Print the plot:
obj

# Get parameters of annotations:
plotly_annotation_list(obj)
plotly_annotation_n(obj)
plotly_annotation_text(obj)


# The same plot with all annotations removed:
plotly_annotation_rm(obj)

GegznaV/spPlot documentation built on April 29, 2020, 11:06 p.m.