英文:
is there any way to get plotly radar charts with a complete line using go.Scatterpolar()?
问题
在 plotly 的散点雷达图示例中(此处),其中一个线段缺失。我自己尝试时也是如此 - 我认为如果您正在使用 plotly express,可以使用 line_close
。在使用 go.Scatterpolar 中是否有等效选项?
英文:
In plotly's example scatter radar plots (here), one of the line segments is missing. This is also the case when I've tried it myself - I think if you're using plotly express you can use line_close
. Is there an equivalent in using go.Scatterpolar?
答案1
得分: 1
在参考文献中的示例中创建了一个图形对象,线条没有封闭。要封闭它,需要调整数据。这可以通过重复第一个点来实现。
import plotly.graph_objects as go
r = [1, 5, 2, 2, 3]
r.append(r[0])
theta = ['processing cost','mechanical properties','chemical stability','thermal stability','device integration','processing cost']
theta.append(theta[0])
fig = go.Figure(data=go.Scatterpolar(
r=r,
theta=theta,
fill='toself'
))
fig.update_layout(autosize=False,
height=450,
polar=dict(
radialaxis=dict(
visible=True
),
),
showlegend=False)
fig.show()
英文:
The examples in the reference are created in a graph object and the lines are not closed. To close it, the data must be adjusted. This is accomplished by repeating the first point.
import plotly.graph_objects as go
r = [1, 5, 2, 2, 3]
r.append(r[0])
theta = ['processing cost','mechanical properties','chemical stability','thermal stability','device integration','processing cost']
theta.append(theta[0])
fig = go.Figure(data=go.Scatterpolar(
r=r,
theta=theta,
fill='toself'
))
fig.update_layout(autosize=False,
height=450,
polar=dict(
radialaxis=dict(
visible=True
),
),
showlegend=False)
fig.show()
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论