有没有办法使用 go.Scatterpolar() 获得完整线条的 Plotly 雷达图?

huangapple go评论74阅读模式
英文:

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()

有没有办法使用 go.Scatterpolar() 获得完整线条的 Plotly 雷达图?

英文:

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()

有没有办法使用 go.Scatterpolar() 获得完整线条的 Plotly 雷达图?

huangapple
  • 本文由 发表于 2023年2月13日 23:57:05
  • 转载请务必保留本文链接:https://go.coder-hub.com/75438288.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定