---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-225-639a71933a75> in <module>
28 ###
29
---> 30 ax.set_thetagrids(angles * 180/np.pi, all_keyword) # 添加每個特徵的標籤
31 ax.set_ylim(0,1)# 設置雷達圖的範圍
32
~/opt/anaconda3/lib/python3.8/site-packages/matplotlib/projections/polar.py in set_thetagrids(self, angles, labels, fmt, **kwargs)
1344 self.set_xticks(angles)
1345 if labels is not None:
-> 1346 self.set_xticklabels(labels)
1347 elif fmt is not None:
1348 self.xaxis.set_major_formatter(mticker.FormatStrFormatter(fmt))
~/opt/anaconda3/lib/python3.8/site-packages/matplotlib/axes/_base.py in wrapper(self, *args, **kwargs)
61
62 def wrapper(self, *args, **kwargs):
---> 63 return get_method(self)(*args, **kwargs)
64
65 wrapper.__module__ = owner.__module__
~/opt/anaconda3/lib/python3.8/site-packages/matplotlib/cbook/deprecation.py in wrapper(*args, **kwargs)
449 "parameter will become keyword-only %(removal)s.",
450 name=name, obj_type=f"parameter of {func.__name__}()")
--> 451 return func(*args, **kwargs)
452
453 return wrapper
~/opt/anaconda3/lib/python3.8/site-packages/matplotlib/axis.py in _set_ticklabels(self, labels, fontdict, minor, **kwargs)
1791 if fontdict is not None:
1792 kwargs.update(fontdict)
-> 1793 return self.set_ticklabels(labels, minor=minor, **kwargs)
1794
1795 @cbook._make_keyword_only("3.2", "minor")
~/opt/anaconda3/lib/python3.8/site-packages/matplotlib/axis.py in set_ticklabels(self, ticklabels, minor, **kwargs)
1712 # remove all tick labels, so only error for > 0 ticklabels
1713 if len(locator.locs) != len(ticklabels) and len(ticklabels) != 0:
-> 1714 raise ValueError(
1715 "The number of FixedLocator locations"
1716 f" ({len(locator.locs)}), usually from a call to"
ValueError: The number of FixedLocator locations (10), usually from a call to set_ticks, does not match the number of ticklabels (9).
在我環境中雷達圖會報以下錯誤在ax.set_thetagrids(angles * 180/np.pi, all_keyword). 我解決方法是將all_keyword改成numpy array 並調整總數為10
執行時完整錯誤: