ggplotly

0th

Percentile

Create plotly graphs using ggplot2 syntax

See up-to-date documentation and examples at https://plot.ly/ggplot2

Usage
ggplotly(p = ggplot2::last_plot(), width = NULL, height = NULL, tooltip = "all", layerData = 1, originalData = TRUE, source = "A", ...)
Arguments
p
a ggplot object.
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 tooltip = c("y", "x", "colour") if you want y first, x second, and colour last.
layerData
data from which layer should be returned?
originalData
should the "original" or "scaled" data be returned?
source
Only relevant for event_data.
...
arguments passed onto methods.
Value

a plotly object

See Also

signup(), plot_ly()

Aliases
  • ggplotly
Examples
library(plotly) ## Not run: # # simple example # ggiris <- qplot(Petal.Width, Sepal.Length, data = iris, color = Species) # ggplotly(ggiris) # # data(canada.cities, package = "maps") # viz <- ggplot(canada.cities, aes(long, lat)) + # borders(regions = "canada") + # coord_equal() + # geom_point(aes(text = name, size = pop), colour = "red", alpha = 1/2) # ggplotly(viz, tooltip = c("text", "size")) # ## End(Not run)
Documentation reproduced from package plotly, version 4.5.2, License: MIT + file LICENSE

Community examples

mohamed.khamis@ejust.edu.eg at Dec 3, 2018 plotly v4.8.0

# NOT RUN { # simple example ggiris <- qplot(Petal.Width, Sepal.Length, data = iris, color = Species) ggplotly(ggiris) data(canada.cities, package = "maps") viz <- ggplot(canada.cities, aes(long, lat)) + borders(regions = "canada") + coord_equal() + geom_point(aes(text = name, size = pop), colour = "red", alpha = 1/2) ggplotly(viz, tooltip = c("text", "size")) # linked scatterplot brushing d <- highlight_key(mtcars) qplot(data = d, x = mpg, y = wt) %>% subplot(qplot(data = d, x = mpg, y = vs)) %>% layout(title = "Click and drag to select points") %>% highlight("plotly_selected") # more brushing (i.e. highlighting) examples demo("crosstalk-highlight-ggplotly", package = "plotly") # client-side linked brushing in a scatterplot matrix highlight_key(iris) %>% GGally::ggpairs(aes(colour = Species), columns = 1:4) %>% ggplotly(tooltip = c("x", "y", "colour")) %>% highlight("plotly_selected") # } # NOT RUN { # }