Closed darinkist closed 2 years ago
Nevermind... found my mistake. One can solve it by using the following code:
from mplsoccer.radar_chart import Radar
## parameter names
params = ['xAssist', 'Key Passes', 'Crosses Into Box', 'Cross Completion %', 'Deep Completions',
'Progressive Passes', 'Prog. Pass Accuracy', 'Dribbles', 'Progressive Runs',
'PADJ Interceptions', 'Succ. Def. Actions', 'Def Duel Win %']
## range values
ranges = [(0.0, 0.15), (0.0, 0.67), (0.06, 6.3), (19.51, 50.0), (0.35, 1.61),
(6.45, 11.94), (62.9, 79.4), (0.43, 4.08), (0.6, 2.33),
(4.74, 7.2), (8.59, 12.48), (50.66, 66.67)]
min_range = [0.0,0.0,0.06,19.51,0.35,6.45,62.9,0.43,0.6,4.74,8.59,50.66]
max_range = [0.15, 0.67, 6.3, 50.0,1.61,11.94,79.4,4.08,2.33,7.2,12.48,66.67]
## parameter value
values = [0.11, 0.53, 0.70, 27.66, 1.05, 6.84, 84.62, 4.56, 2.22, 5.93, 8.88, 64.29]
## instantiate object
radar = Radar(params, min_range, max_range)
fig, ax = radar.setup_axis() # format axis as a radar
rings_inner = radar.draw_circles(ax=ax, facecolor='#ffffff', edgecolor='#000000') # draw circles
radar_output = radar.draw_radar(values, ax=ax,
kwargs_radar={'facecolor': '#709775','alpha': 0.8},
kwargs_rings={'facecolor': '#709775', 'alpha':0.0}) # draw the radar
range_labels = radar.draw_range_labels(ax=ax, fontsize=8)
param_labels = radar.draw_param_labels(ax=ax, fontsize=12, **{'color':'#ffffff'}) # draw the param labels
Nice thanks for posting the solution. 😊
Hi,
when I create a simple radar cart:
I get the following visualization where (depending on the ring) the color of the polygon is lighter or darker green: Is there a way to avoid the changing colors of the polygon for every ring?