I’m working with plots that display ‘n’ names of items, and am therefore creating a dynamic title containing the items names like so:
string_of_item_names = "Item1, Item2, Item3" this_title = "Plot 1 — " + string_of_item_names this_figure = px.scatter(df, title=this_title)
However, this title can get very large, say, if there were 10-20 item names in the ‘string_of_item_names’, and dash seems to cut off the rest of the title that doesn’t fit in the width of the plot instead of adding a br tag to move the remainder of the title to the next line.
Is there a way to dynamically or automatically add the br tag within the title where it should be so it shows properly without cutting off the text?
I would just manually add one after every ‘n’ elements but unfortunately the item names vary greatly, and sometimes 1 item will fit in the first line of the title before needing a br and other times 4 items will fit without needing a br