Line breank in scatteroplar title

Hello

Do you perhaps know how to add a line break to the title text of a scatterpolar plot?

I tried “br” in the brackets < and > but it doesn’t work. This is my code:

PLOTTING OF UNIFORMLY DISTRIBUTED SET OF FRACTURES.

fig1 = go.Figure()
fig1.add_traces(go.Scatterpolar(r = fraDat[‘poleRad’],
theta = fraDat[‘pAzi’],
thetaunit = ‘degrees’,
name = ‘fracture poles’,
mode = ‘markers’,
marker_size = 4,
line_color = ‘royalblue’,
showlegend = True))

fig1.update_layout(margin = dict(l=40, r=40, t=60, b=40),
paper_bgcolor = “LightSteelBlue”,
width = 400, height = 400,
title_text = 'Uniformly distributed set of ‘+str(n_fracs)+
’ fractures
(Schmidt Equal Area stereonet)’,
title_font_size = 12,
font = dict(size = 10))

fig1.update_polars(radialaxis = dict(range=[0, 1],
tickvals = [0.1233, 0.2456, 0.3660,
0.4837, 0.5977, 0.7071,
0.8111, 0.9090, 1],
showticklabels = False),
angularaxis = dict(direction=“clockwise”, dtick=30))
fig1.show()

Thanks a lot for your help.

Best regards,
Martin

If you want to break a too long title, use the html tag, br:

import plotly.graph_objects as go

fig =go.Figure(go.Scatterpolar(r=[0.5, 1, 0.75], theta=[65, 120, 200 ]))
n_fracs=85
mytitle=f"Uniformly distributed set of {n_fracs} fractures"+\
"<br>(Schmidt Equal Area stereonet)"
fig.update_layout(title_text=mytitle, title_x=0.5)

2 Likes

Hi Empet

Thanks a lot! I tried again and also selected instead of “inline” another method to plot the diagram in which case the title was printed on two lines. Must be something with the “inline” plotting that prevents the line from breaking.

Best wishes,
Martin