0

Plotly docs says I can use go.Table and use key of columnwidth and an array with the widths. Well this isn't doing much because my columns are still cutoff and cannot be made wide enough.

Any ideas on how to ensure the columns match the header and cell widths?

column_widths = [75, 75, 75, 100, 100, 100,
                 75, 75, 75, 75, 75, 75, 75, 100, 225]

fig = pgo.Figure(data=[pgo.Table(
                columnwidth=column_widths,
                header=dict(values=list(df.columns),
                            fill_color='lightgray',
                            align='center'),
                cells=dict(values=df.transpose().values.tolist(),
                           fill_color='white',
                           align='left'))
            ])

Michael Paccione
  • 2,467
  • 6
  • 39
  • 74
  • Note that the width of columns is expressed as a ratio here, ie. `columnwidth=[x, y, z]` means the first column should take x/(x+y+z) times the table width, the 2nd column y/(x+y+z) and the 3rd z/(x+y+z). – EricLavault May 25 '23 at 14:20
  • Hi Eric, I suppose then the question is how do you make the overall table larger? I intend to export this as a png. – Michael Paccione May 26 '23 at 03:01
  • 1
    Did you try `fig.update_layout(width=somewidth)` ? Also note that you can set the image width, height and scale during the export. @see https://plotly.com/python/static-image-export/#change-image-dimensions-and-scale – EricLavault May 26 '23 at 09:53

0 Answers0