Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using multiple font sizes in Plotly chart title (Python)

I have a chart title which spans multiple lines using line breaks.

I'd like to have everything after the first line in a smaller font (effectively a subtitle), but can't figure out a way to do this.

Couldn't see any similar question on here.

import plotly.graph_objs as go
data=[]
layout = go.Layout(title='line1' + '<br>' +  'line2')
fig = go.FigureWidget(data=data, layout=layout)
fig

Any ideas appreciated!

like image 813
Ads Avatar asked Jun 06 '26 11:06

Ads


1 Answers

Yes, you can use <span> tags with CSS, like this:

import plotly.graph_objs as go
data=[]
layout = go.Layout(title='line1' + '<br>' +  '<span style="font-size: 12px;">line2</span>')
fig = go.FigureWidget(data=data, layout=layout)
fig

enter image description here

like image 94
nicolaskruchten Avatar answered Jun 08 '26 23:06

nicolaskruchten



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!