plot_ly function displaing empty plot with no data

Hello everybody,
I'm trying to plot a simple scatter plot with the plotly package using the following command:

plot_ly(mtcars, x="wt", y="mpg",type = "scatter", mode = "markers")

I'm getting an empty plot (just x and y axis) and a massage:

`arrange_()` is deprecated as of dplyr 0.7.0.
Please use `arrange()` instead.
See vignette('programming') for more help
This warning is displayed once every 8 hours.
Call `lifecycle::last_warnings()` to see where this warning was generated.

My dplyr version is 1.0.0 and plotly version is
Anyone encountered this?

Either you give an explicit reference to the data (mtcars$wt) or you provide the data and variable names separately, in that case you need to use formulas:

plot_ly(mtcars, x=~wt, y=~mpg,type = "scatter", mode = "markers")
# same result:
plot_ly(x=mtcars$wt, y=mtcars$mpg,type = "scatter", mode = "markers")

In your example, since you're not providing a formula, plot_ly assumes you're providing data. So it does exactly what you ask: it plots the character string "mpg" against the string "wt".

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.