Tried to use Plotly for making XRD analysis plot, and I’ve got the little problem… It’s about rotation text in “markers+text” mode in go.Scatter. Here is some code:
import plotly
import chart_studio.plotly
import plotly.graph_objects as go
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
import plotly.express as px
import math
from plotly.subplots import make_subplots
AuBN_US = np.genfromtxt('somedatfile.dat')
AuBN_noUS = np.genfromtxt('otherdatafile.dat')
dataBN = pd.read_csv('somecsvfile.csv', sep=';')
dataAu = pd.read_csv('othercsvfile.csv', sep=';')
fig = make_subplots(rows=2, cols=1, y_title='Intensity', x_title="2\u03F4")
fig.add_trace(go.Scatter(x=AuBN_US[:,0], y=AuBN_US[:,1],
mode='lines',
name='AuBN_US'),
row=1, col=1)
fig.add_trace(go.Scatter(x=AuBN_noUS[:,0], y=AuBN_noUS[:,1],
mode='lines',
name='AuBN_noUS'),
row=2, col=1)
fig.add_trace(go.Scatter(x = dataBN['Angle'], y = dataBN['Int']+100,
mode='markers+text',
text=dataBN['hkl'],
textposition="top center",
name='BN',
orientation='v',
marker=dict(size=10, symbol="triangle-down")))
fig.add_trace(go.Scatter(x= dataAu['Angle'], y=dataAu['Int']+100,
name='Au',
mode='markers+text',
text=dataAu['hkl'],
textposition="top center",
orientation='v',
marker=dict(size=10, symbol="square")))
fig.update_layout(template="plotly_white", font=dict(family="Courier New,
monospace",
size=14,
color="black"))
fig.show()
Result:
Is it possible to rotate all indexes (100…) in a simple way? I have already tried “textangle” but always got errors.