Black Lives Matter. Please consider donating to Black Girls Code today.
Learn how to use COVID-19 data in open source Dash apps. Register for the Sept 23rd webinar with IQT!

Breaking lines in a table

Hi all,

i am trying to display a longer text in a table, but unfortunately, it overflows. Is there a possibility to break it into lines?

I am using the code from the sample:

import plotly.plotly as py
from plotly.tools import FigureFactory as FF 

data_matrix = [['Country', 'Year', 'Population'],
['Some reaaallyy loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong text', 2015, 15]
]

table = FF.create_table(data_matrix)
py.iplot(table, filename='simple_table')

Thank you for help,
Adam

Hi there,
To break up your line you’ll have to add an html break: < br >
similar to this example: https://plot.ly/python/table/#tables-with-graphs

1 Like

Thank you very much Chelsea! It solved the problem. Although, i find it quite complicated to break the lines like this. Would be great if plotly could natively do this.