Description Usage Arguments Examples
View source: R/generic_methods.R
This function provides functionality to automatically generate interactive plot for many popular statistical results supported by 'ggfortify' package using 'plotly.js' and 'ggplot2'.
This package provides functionalities to automatically generate interactive visualizations for many popular statistical results supported by ggfortify package with 'plotly.js' and 'ggplot2' style. The generated plot can also be easily extended using 'ggplot2' and 'plotly' syntax while staying interactive.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
object |
The object that represents your statistical result, e.g. |
... |
Arguments passed to |
width |
Width of the plot in pixels (optional, defaults to automatic sizing). |
height |
Height of the plot in pixels (optional, defaults to automatic sizing). |
tooltip |
a character vector specifying which aesthetic mappings to show
in the tooltip. The default, "all", means show all the aesthetic mappings
(including the unofficial "text" aesthetic). The order of variables here will
also control the order they appear. For example, use
|
dynamicTicks |
should plotly.js dynamically generate axis tick labels? Dynamic ticks are useful for updating ticks in response to zoom/pan interactions; however, they can not always reproduce labels as they would appear in the static ggplot2 image. |
layerData |
data from which layer should be returned? |
originalData |
should the "original" or "scaled" data be returned? |
source |
a character string of length 1. Match the value of this string
with the source argument in |
widths |
relative width of each column on a 0-1 scale. By default all columns have an equal relative width. |
heights |
relative height of each row on a 0-1 scale. By default all rows have an equal relative height. |
margin |
either a single value or four values (all between 0 and 1). If four values are provided, the first is used as the left margin, the second is used as the right margin, the third is used as the top margin, and the fourth is used as the bottom margin. If a single value is provided, it will be used as all four margins. |
shareX |
should the x-axis be shared amongst the subplots? |
shareY |
should the y-axis be shared amongst the subplots? |
titleX |
should x-axis titles be retained? |
titleY |
should y-axis titles be retained? |
which_layout |
adopt the layout of which plot? If the default value of "merge" is used, layout options found later in the sequence of plots will override options found earlier in the sequence. This argument also accepts a numeric vector specifying which plots to consider when merging. |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | # Automatically generate interactive plot for results produced by `stats::prcomp`
p <- autoplotly(prcomp(iris[c(1, 2, 3, 4)]), data = iris,
colour = 'Species', label = TRUE, label.size = 3, frame = TRUE)
# You can apply additional ggplot2 elements to interactive plot built using `autoplotly()`
p +
ggplot2::ggtitle("Principal Components Analysis") +
ggplot2::labs(y = "Second Principal Components", x = "First Principal Components")
# Or apply additional plotly elements to the generated interactive plot
p %>% plotly::layout(annotations = list(
text = "Example Text",
font = list(
family = "Courier New, monospace",
size = 18,
color = "black"),
x = 0,
y = 0,
showarrow = TRUE))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.