Learn R Programming

plotly (version 3.4.1)

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", 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
source
Only relevant for event_data.

Value

  • a plotly object

See Also

signup, plot_ly

Examples

Run this code
# 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)

Run the code above in your browser using DataLab