更改雷达图的背景形状

时间:2020-05-07 14:22:38

标签: python plotly radar-chart

我希望在Plotly中制作类似于this one的雷达图。我当前的情节看起来是like this

对于Plotly中的极坐标图,它具有默认的圆形背景,但我想将其更改为与我正在建模的六边形相似的匹配六边形,最好是内部径向网格。除了删除背景并使用Figure.add_shape手动绘制背景并绘制单个线条/路径外,我不确定如何在Plotly中进行操作。

是否可以在Plotly中进行操作,还是最好使用另一个库?

代码:

import plotly.graph_objects as go

fig = go.Figure()
    fig.add_trace(go.Scatterpolar(r = plotdf.loc[:,i], theta = plotdf.index, mode = 'lines', 
                                  line_width = 2, line_color = 'darkblue', opacity = 0.8))
    fig.update_traces(fill='toself', fillcolor = 'lightblue')
    fig.update_layout(title=dict(text = i, x = 0.5, y = 0.95),
                      polar = dict(
                                   radialaxis_angle = -30,
                                            radialaxis_tickfont_size = 12,
                                            angularaxis_tickfont_size = 16,
                                            angularaxis = dict(direction = 'clockwise', period = 6, gridcolor = 'black', linecolor = 'rgba(0,0,0,0)'),
                                           radialaxis = dict(showgrid = True, showline = False, showticklabels = True, 
                                                             range = (0,100), layer = "above traces")),
                     paper_bgcolor = 'lightgrey')

0 个答案:

没有答案
相关问题