Unable to convert DATE/POSIXct from ggplot2 to PLOTLY

I am trying to convert a geom_smooth ggplot to plotly and am encountering an error.

Specifically, here is the ggplot definition:

myplot<- ggplot() + geom_smooth(method=gam, formula=y~s(x,bs=“cc”,k=12), data=test2 , aes(x=test2$STAY_DATE, y=test2$OCCUPANCY , shape=test2$PROPERTY_NAME , color=test2 $PROPERTY_NAME))

running “myplot” works as expected.

However, when using plot_ly or ggplotly. I get the following error:

Error in inherits(data.vec, “POSIXt”) : object ‘data.vec’ not found

What I noticed is that it gives thie error anytime I have a DATE or a POSIXct in the x variable. It work with non-DATE columns.

Is this a bug? I assume plotly can convert this per the documentation.

Please advise.

1 Like