Table header not showing in Jupyter notebook

Hello, I’m trying to create a Table in a Jupyter notebook and I cannot figure out how to display the header. The header is displayed perfectly when outputting to a browser, but not when in a notebook cell. This seems a problem in plotly 3.3 and 2.7. I have changed the values dict to a list of lists and been through the go.table.Header help file. Thx in advance to any insight on this problem! Sample code as an example…

import plotly.graph_objs as go
fig2 = go.FigureWidget()
fig2.add_table(header = go.table.Header({‘values’: [[‘A Scores’], [‘B Scores’]],
‘align’:[‘left’] * 5,
‘fill’: {‘color’: ‘#a1c3d1’},
‘height’: 20,
‘line’: {‘color’: ‘#7D7F80’, ‘width’: 20}}),
cells = {‘values’: [[100, 90, 80, 90], [95, 85, 75, 95]],
‘align’: [‘center’] * 5,
‘fill’: {‘color’: ‘#EDFAFF’},
‘line’: {‘color’: ‘#7D7F80’}})
fig2

Hi @smab,

Could you post a screenshot of what you’re seeing in the notebook? It seems to be working for me in both the classic notebook and in JupyterLab

newplot%20(4)

Note that the reason that the gray headers look out of alignment is because of the header.line.width is so large. If I remove this, here’s what it looks like

-Jon

Hi Jon,
I am using Jupyter notebooks and not Jupyterlab. (Jupyter notebook ver. 5.6 and Plotly ver. 3.3) I ran it with and without the width adjustment with no change.
Thanks, Sam

Here is the whole cell. Feel like I must be missing something simple!

Huh, interesting. Here are a few questions to see if we can start to narrow things down.

  • Are you working in the classic notebook for JupyterLab?
  • What OS and browser version are you using?
  • Do you see the headers in the examples at https://plot.ly/javascript/table/

-Jon

Jon,

  • I am working in the classic notebook(ver 5.6) and Linux Ubuntu 16.04 with Firefox Quantum(ver 62.03).
  • The header is displayed when the table is output to the browser, just not when it’s output is sent to a notebook cell.
  • Is there a Ipywidgets import I might be missing?
  • Wonder if there is something in the Jupyter config file that is causing the problem?

-Sam

Hi @smab,

Nothing else comes to mind. I’d recommend trying in chrome and disabling your dark theme and see if that makes a difference.

-Jon

Thanks for the help Jon. After resetting my Jupyter theme( and clearing browser cache), the headers are now showing in the cells using Firefox. Not sure what was different between the two config files. Back in business!

Thx, Sam

1 Like

can someone help me on how to to run dash plotly , have met all the requirement