plotly (version 4.5.2)

ggplotly: Create plotly graphs using ggplot2 syntax

Description

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()

Examples

Run this code
# 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"))
# }
# NOT RUN {
# }

Run the code above in your browser using DataLab