Black Lives Matter. Please consider donating to Black Girls Code today.
Learn how to use COVID-19 data in open source Dash apps. Register for the Sept 23rd webinar with IQT!

Unable to upload graph due to Client Error (400) Bad Request

I have been trying to work on graphs in R, and upload them into my account. This works the majority of the time, except for when I am uploading a heat map, or any other graph that uses ‘aes(fill = X)’. Here’s my example:

library(plotly)
df <- cor(mtcars)
df <- melt(df)
colnames(df) <- c("X", "Y", "Correlation")

test.plot <- ggplotly(ggplot(df, aes(x = X, y = Y, fill = Correlation)) + 
  geom_tile())

api_create(test.plot, "tester plot", sharing = "private")

I receive the error:
Error: Client error: (400) Bad Request
Figure field is invalid. Reason: Raw data arrays are not allowed at this endpoint. Use grid references instead. Raw data found at the following paths in the figure [(‘data’, 1, u’marker’, u’colorbar’, u’ticktext’), (‘data’, 1, u’marker’, u’colorbar’, u’tickvals’)]

When I remove the fill tag, it uploads just fine. However, for heat maps, I need the fill function - and it currently won’t work.

In order to diagnose, I checked the version of Plotly I was using, and it was the dev version of 4.7.1.9000. I rolled back to 4.7.1, and the same error occurred. I also attempted to use multiple geoms to no avail. The same error occurs each time.

I need to utilise R to generate the graphs to keep it automated. If there is any way to correct this, I would greatly appreciate it.