Title: | Automatic Generation of Interactive Visualizations for Statistical Results |
---|---|
Description: | Functionalities to automatically generate interactive visualizations for statistical results supported by 'ggfortify', such as time series, PCA, clustering and survival analysis, with 'plotly.js' <https://plotly.com/> and 'ggplot2' style. The generated visualizations can also be easily extended using 'ggplot2' and 'plotly' syntax while staying interactive. |
Authors: | Yuan Tang [aut, cre] |
Maintainer: | Yuan Tang <[email protected]> |
License: | GPL-2 |
Version: | 0.1.4 |
Built: | 2024-10-29 04:32:23 UTC |
Source: | https://github.com/terrytangyuan/autoplotly |
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.
autoplotly( object, ..., width = NULL, height = NULL, tooltip = "all", dynamicTicks = FALSE, layerData = 1, originalData = TRUE, source = "A", widths = NULL, heights = NULL, margin = 0.02, shareX = TRUE, shareY = TRUE, titleX = shareX, titleY = shareY, which_layout = "merge" )
autoplotly( object, ..., width = NULL, height = NULL, tooltip = "all", dynamicTicks = FALSE, layerData = 1, originalData = TRUE, source = "A", widths = NULL, heights = NULL, margin = 0.02, shareX = TRUE, shareY = TRUE, titleX = shareX, titleY = shareY, which_layout = "merge" )
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. |
# 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))
# 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))