Radar Chart cuts numbers in half

71 Views Asked by At

Layers in my radar chart are not working properly. Numbers are cut in halves in the radar. Using soccer.plots library.

Tried z-order, changed the plot-order, all colors, fonts, alphas. I need the numbers in the radar to be visible fully.

mpl soccer works fine, soccerplots wants to update the package, to get rid of the z-order prob.

import numpy as np
import matplotlib.pyplot as plt
from math import pi
from soccerplots.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)]

# Parameter values
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]


# Plot radar
fig, ax = radar.plot_radar(ranges=ranges, params=params, values=values, 
                           radar_color=['#B6282F', '#808080'], zorder=1, alphas=[0.3])

## instantiate object 
radar = Radar(background_color="#121212", patch_color="#28252C", label_color="#F0FFF0",
              range_color="#F0FFF0", fontfamily="Arial", )


plt.show()

enter image description here

1

There are 1 best solutions below

2
On

From the looks of it, it seems like an issue with font sizes which you should be able to control. a quick search on the mpl soccer website provides this simple example:

fig, ax = radar.setup_axis()  # format axis as a radar
rings_inner = radar.draw_circles(ax=ax, facecolor='#ffb2b2', edgecolor='#fc5f5f')  # draw circles
radar_output = radar.draw_radar(bruno_values, ax=ax,
                                kwargs_radar={'facecolor': '#aa65b2'},
                                kwargs_rings={'facecolor': '#66d8ba'})  # draw the radar
radar_poly, rings_outer, vertices = radar_output
range_labels = radar.draw_range_labels(ax=ax, fontsize=15,
                                       fontproperties=robotto_thin.prop)  # draw the range labels
param_labels = radar.draw_param_labels(ax=ax, fontsize=15,
                                       fontproperties=robotto_thin.prop)  # draw the param labels

you could also be overlaying one part of the graph over another which blocks out the text. Try their examples and let me know how it goes.