我正在尝试用 python 绘制一个极坐标图,并以 plotly 显示二维图像中纤维的方向(请参阅下面的代码)。如果您能向我展示如何更改角轴(当前范围从 0° 到 360°)以匹配我的数据范围从 -90° 到 90°,那就太好了。下面是半极坐标图的示例图像、我的数据格式和我的代码。
import plotly.graph_objs as go
from plotly import plotly
import plotly.offline as offline
import numpy as np
# data
x= np.genfromtxt(see data image)
y= np.genfromtxt(see data image)
trace = [
go.Scatterpolar(
r = [y], #radial coordinates
theta = [x], #angular coordinates
mode = 'markers',
marker = dict(
color = 'peru'
)
)
]
layout = go.Layout(
showlegend = True,
polar = dict(
domain = dict( # set chart size and position
x = [0, 0.8],
y = [0.3, 0.8]),
sector = [0, 180], # set chart shape (half or full)
angularaxis = dict(
thetaunit = "degrees",
dtick = 10),
radialaxis = dict(
range = [1, 8000])
))
fig = go.Figure(data=trace, layout=layout)
offline.plot(fig)
xy数据
纤维取向的半极坐标图
MMMHUHU
桃花长相依
相关分类