因此,我尝试使用 Plotly 制作XRD分析图,但我遇到了一些小问题……这与go.Scatter中“标记+文本”模式下的旋转文本有关。这是一些代码:
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,
是否可以通过简单的方式旋转所有索引(100 ....)? 我已经尝试过“ textangle”,但是总是出错。