When using the Plotly, I can set the title font in the layout part as follow.
titlefont=dict(size =14, color='black', family='Arial, sans-serif')
My question is How to set the font as Bold. Thanks
One method for getting bold text is to change the font to Arial Black (or other bold font) which should be available on most systems. This method will scale a little easier to axes and other elements.
The default font family spec is "Open Sans", verdana, arial, sans-serif , as listed in Python Figure Reference: layout from the Plotly documentation. The precise font selected depends on which fonts you have installed on your system. If Open Sans is available, that font will be selected.
The font-weight CSS property sets the weight (or boldness) of the font.
If you are using Python you can add the <b>
html tag to the title attribute and you are good.
You can add some more limited HTML styling such as italic as well, see example below.
import plotly
plotly.offline.init_notebook_mode()
data = [plotly.graph_objs.Bar(
x=['giraffes', 'orangutans', 'monkeys'],
y=[20, 14, 23]
)]
layout = go.Layout(title='<b>Bold</b> <i>animals</i>')
fig = plotly.graph_objs.Figure(data=data, layout=layout)
plotly.offline.iplot(fig)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With