Black Lives Matter. Please consider donating to Black Girls Code today.

Axis titles not displayed when I'm in a project ( plot_ly function)

The entirety of the details can be found in the following link:

I am using R3.4.0 and I am developing under RStudio in Windows 10 in the form of a project to produce a package. I don’t understand why the titles of the axes don’t appear. I don’t even have an error message.
Surprisingly enough when I’m using the script of the function outside of the package the axis titles are then displayed, why is this?
I mention that I absolutely need to have this work inside a package.
I have looked inside the data using the debug function for the function plot_ly as well as inside the functions called by it (config, as_widget etc…) everything seemed normal.

Hi Matt,
You should define the layout() of your plot.

p <- plot_ly(x = 1:10, y = 1:10, mode = "markers", type="scatter", mode="lines") %>%
  layout(xaxis = list(title="tr"), yaxis = list(title="ts"))

Hi Cayij, Thank you so much for replying, however, when I do as you say under a project, I get the error message:

 Error in layout(., xaxis = list(title = "tr"), yaxis = list(title = "ts")) : 
 unused arguments (xaxis = list(title = "tr"), yaxis = list(title = "ts")) 

When I do as you say under RGui, everything works perfect. I’m starting to thing it could be a bug in plotly.

Apparently, the issue has also been raised on GitHub by somebody else ( :slight_smile: ) :

That error is likely due to a namespacing issue – try replacing layout() with plotly::layout()

Thank you so much Carson ! It has worked.
I think that what got me was that I was using the layout from graphics instead of the layout from plotly because when I looked on google the only layout I found was the layout from graphics. I gave your answer on stackoverflow