Plotly express and dash with facet_col


Earlier i was using Plotly python and discovered plotly_express recently. I liked it very much and decided to switch. This is a beautiful tool.

I am trying to create a scatter plot using plotly_express.
When executed within jupyter notebook the plot is perfect and beautiful.

import plotly_express as px

px.scatter(edf.tail(5), x=‘timestamp’, y=‘watt’, size=‘current’, facet_col=‘channel’, color=‘temperature’)

When this same thing is served via Dash, there is error on the JavaScript “Error unrecognized date NaN”. Chart with no points are displayed and side color bar indicator is missing.

If facet_col is removed, error goes away and chart without column facet is displayed, still with missing color bar indicator on side.

There seems some interplay between date parsing and facet handling.

Sample data to reproduce the problem

Version information:
plotly 3.10.0 py_0 plotly
plotly_express 0.3.1 py_0 plotly

On JavaScript console
Plotly.version “1.47.0”

Hi @readall, welcome to the forums! And glad to hear you’re enjoying plotly express!

My first guess is that the problem here is a mismatch in the plotly.js version between what your version of Plotly express is expecting (1.48.0) and what your version of Dash provides (maybe < 1.48). Dash 1.0.0 came out a couple of days ago, could you try upgrading that if you’re not on 1.0.0 already?



Sorry for delayed response.
I moved to dash==1.0.0 and still face the same issue.

As the date parsing fails in combination with facet_col option, the dates displayed are year 2000 which seems to come from some default values in JS files supplied by plotly.



Finally something has made it work.
I tried these few things and now it is working fine.

  1. Multiple times i removed and installed plotly 3.10.0 and 4.0.0a4.
  2. Finally reverting to plotly 3.10 as plotly_express does not like 4.0.xx
  3. I have changed dash code to explictly use 1.48.0 js.
  4. As default behavior dash continues to push 1.47.x which has this bug.

We can close this issue now.

1 Like