Table header not showing in Jupyter notebook


#1

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


#2

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

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


#3

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


#4

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


#5

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


#6

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


#7

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


#8

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


#9

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