Python 绘图仪雷达图-变量参考值
我正在构建一个绘图仪雷达图,我有一些变量,返回数组作为雷达图中的值。但是,它不显示我的值。你能给个建议吗?谢谢 变量输出:Python 绘图仪雷达图-变量参考值,python,plotly,Python,Plotly,我正在构建一个绘图仪雷达图,我有一些变量,返回数组作为雷达图中的值。但是,它不显示我的值。你能给个建议吗?谢谢 变量输出: output of aa > array([0.38570075] output of bb > array([0.37840411] output of cc > array([0.23178026] output of dd > array([0.00411487] output of ee > 0 import plotly.graph
output of aa > array([0.38570075]
output of bb > array([0.37840411]
output of cc > array([0.23178026]
output of dd > array([0.00411487]
output of ee > 0
import plotly.graph_objects as go
categories = ['A', 'B', 'C', 'D', 'E']
fig = go.Figure()
fig.add_trace(go.Scatterpolar(
r=[aa,bb,cc,dd,ee],
theta=categories,
fill='toself',
name='Egress & Access'
))
fig.update_layout(
polar=dict(
radialaxis=dict(
visible=True,
range=[0, 1]
)),
showlegend=True
)
fig.show()
如果像下面的示例那样从数组中提取值,那么代码应该可以工作
import plotly.graph_objects as go
import numpy as np
aa = np.array([0.38570075])
bb = np.array([0.37840411])
cc = np.array([0.23178026])
dd = np.array([0.00411487])
ee = 0
categories = ['A', 'B', 'C', 'D', 'E']
fig = go.Figure()
fig.add_trace(go.Scatterpolar(
r=[aa[0], bb[0], cc[0], dd[0], ee],
theta=categories,
fill='toself',
name='Egress & Access'
))
fig.update_layout(
polar=dict(
radialaxis=dict(
visible=True,
range=[0, 1]
)),
showlegend=True
)
fig.show()
如果像下面的示例那样从数组中提取值,那么代码应该可以工作
import plotly.graph_objects as go
import numpy as np
aa = np.array([0.38570075])
bb = np.array([0.37840411])
cc = np.array([0.23178026])
dd = np.array([0.00411487])
ee = 0
categories = ['A', 'B', 'C', 'D', 'E']
fig = go.Figure()
fig.add_trace(go.Scatterpolar(
r=[aa[0], bb[0], cc[0], dd[0], ee],
theta=categories,
fill='toself',
name='Egress & Access'
))
fig.update_layout(
polar=dict(
radialaxis=dict(
visible=True,
range=[0, 1]
)),
showlegend=True
)
fig.show()
谢谢,在我将np.array添加到我的变量之后,它就可以工作了。谢谢谢谢,在我将np.array添加到我的变量之后,它就可以工作了。谢谢