matplotlib 雷达图将数字减半

lokaqttq  于 2023-11-22  发布在  其他
关注(0)|答案(1)|浏览(95)

我的雷达 * 图表中的图层工作不正常。雷达中的数字被切成两半。使用soccer.plots库。
尝试了Z-顺序,改变了情节顺序,所有的颜色,字体,阿尔法。我需要在雷达数字是完全可见的。
mpl soccer工作正常,soccerplots想要更新包,以摆脱z顺序问题。

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

字符串
x1c 0d1x的数据

iyr7buue

iyr7buue1#

从外观上看,这似乎是一个字体大小的问题,你应该能够控制。在mpl soccer website上快速搜索提供了这个简单的例子:

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

字符串
你也可以把图的一部分覆盖在另一部分上,这样就把文字挡住了。试试他们的例子,让我知道它是怎么回事。

相关问题