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'))
            ])

3
  • 1
    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). Commented May 25, 2023 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. Commented May 26, 2023 at 3: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 plotly.com/python/static-image-export/… Commented May 26, 2023 at 9:53

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.