plotly / plotly.R

An interactive graphing library for R
https://plotly-r.com
Other
2.56k stars 626 forks source link

could not find function "ggplotly" #752

Closed talomvalg closed 8 years ago

talomvalg commented 8 years ago

Hi! I keep getting this error

could not find function "ggplotly"

I have tried to reinstall all packages (plotly, ggplot2 and scales) from their respective github repos, but keep getting the error. I only get the error in markdown and not when I run it in Rstudio.

Any ideas why shiny won't let it run?

`--- title: "Untitled" output: flexdashboard::flex_dashboard: orientation: columns vertical_layout: fill

runtime: shiny

library(flexdashboard)

Column {data-width=650}

Chart A

plotly::renderPlotly({

  g <- ggplot2::ggplot(faithful, ggplot2::aes(x = eruptions, y = waiting)) +
  ggplot2::stat_density_2d(ggplot2::aes(fill = ..level..), geom = "polygon") + 
  ggplot2::xlim(1, 6) + ggplot2::ylim(40, 100)

  plotly::ggplotly(g)
})

Column {data-width=350}

Chart B

Chart C

`

cpsievert commented 8 years ago

Adding library(plotly) to the top of your file should fix it

chrisvwn commented 7 years ago

I would like to reopen this issue. I am embedding a shiny application in an R package so loading the library before using ggplotly via library(plotly) is not considered good form. Is this something that can be resolved at source?

Alexander-Minyushkin commented 5 years ago

Check versioning of ggplot2. This is what I got recently:

Error : package 'ggplot2' 2.2.1 is loaded, but >= 3.0.0 is required by 'plotly' ERROR: lazy loading failed for package 'plotly' ..... could not find function "ggplotly"