I would like to use Font Awesome icons in text annotations of a plotly scatter graph.
import plotly.graph_objects as go
fig = go.Figure()
fig.add_trace(go.Scatter(
x=[0, 1, 2],
y=[1, 1, 1],
mode="lines+markers+text",
name="Lines, Markers and Text",
text=["Text A", "Text B", "Text C"],
textposition="top center"
))
fig.add_trace(go.Scatter(
x=[0, 1, 2],
y=[2, 2, 2],
mode="markers+text",
name="Markers and Text",
text=["Text D", "Text E", "Text F"],
textposition="bottom center"
))
fig.add_trace(go.Scatter(
x=[0, 1, 2],
y=[3, 3, 3],
mode="lines+text",
name="Lines and Text",
text=["<i class="fa fa-desktop' aria-hidden='true'></i>", "Text H", "Text I"],
textposition="bottom center"
))
fig.show()
I am running this plot in a das app and have font awesome css stored in /assets. If i add a html.I()
tag fonts appeared as expected.