(我如何在图上加下划线?

问题描述 投票:0回答:1

我尝试在使用注释时在文本上加下划线。我使用

添加我的注释
import plotly.graph_objects as go
g = go.FigureWidget(make_subplots(rows=1,cols=1))
g.update_layout(annotations=[dict(text='my text')]) #plus any other parameters

是否有选项(可能在注释字典中?)带有下划线的文本?

谢谢!

plot text formatting plotly underline
1个回答
0
投票
string = "These are orange" myText = string+'<br>'+ '-'*len(string)

简介:

enter image description here

产品编号:

import plotly.graph_objects as go animals=['giraffes', 'orangutans', 'monkeys'] fig = go.Figure([go.Bar(x=animals, y=[20, 14, 23])]) string = "These are orange" myText = string+'<br>'+ '-'*len(string) fig.update_layout(annotations=[dict(x='orangutans',y = 15, text=myText, font=dict(family='Courier New, monospace'))]) fig.show()

打印源:使用help(fig.layout)

  text
 |                  Sets the text associated with this annotation.
 |                  Plotly uses a subset of HTML tags to do things
 |                  like newline (<br>), bold (<b></b>), italics
 |                  (<i></i>), hyperlinks (<a href='...'></a>).
 |                  Tags <em>, <sup>, <sub> <span> are also
 |                  supported.
© www.soinside.com 2019 - 2024. All rights reserved.