When I use math mode, labels work; when I use no math mode, labels work. However, their combination causes a shift. How to solve that, please? I tried \text{}, \mathrm{}, and both cause the shift.
Thank you
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import plotly.express as px
import plotly.graph_objects as go
d = {'a': [1, 2, 2], 'b': [3, 5, 4], 'c': [0.1, 0.2, 0.6]}
df = pd.DataFrame(data=d)
fig = px.scatter(df, x='a', y='b', error_y='c')
fig.update_xaxes(title_font_family="Trebuchet")
layout = go.Layout(
yaxis=dict(scaleanchor="x", scaleratio=1),
template = "plotly_white",
title="<b>V</b>",
)
fig.layout = layout
fig.update_layout(
xaxis = dict(autorange="reversed")
)
##################
for r, d ,counter in zip(df["a"], df["b"], [0, 1, 2]):
if counter == 0:
name = r'$\alpha$'
if counter == 1:
name = r'$\sigma \text{A}$'
fig.add_annotation(x=r,
y=d,
text = name,
showarrow = True,
ax = 0,
ay = -25
)
###################
fig.show()
