不显示数据点怎么弄
时间: 2023-08-06 12:05:22 浏览: 43
如果您使用的是 Python 中的 Matplotlib 库进行绘图,可以在绘制雷达图时设置参数 `marker` 为 `None`,这样就可以不显示数据点了。下面是一个简单的示例代码:
```python
import matplotlib.pyplot as plt
import numpy as np
# 创建示例数据
categories = ['A', 'B', 'C', 'D', 'E']
values = [3, 2, 4, 1, 5]
# 绘制雷达图
angles = np.linspace(0, 2*np.pi, len(categories), endpoint=False)
values = np.concatenate((values, [values[0]]))
angles = np.concatenate((angles, [angles[0]]))
fig = plt.figure()
ax = fig.add_subplot(111, polar=True)
ax.plot(angles, values, 'o-', linewidth=2, label='Data', marker=None)
ax.fill(angles, values, alpha=0.25)
ax.set_thetagrids(angles * 180/np.pi, categories)
ax.set_title('Radar Chart', fontsize=20)
ax.grid(True)
plt.legend(loc='best')
plt.show()
```
在上述代码中,使用 `ax.plot()` 绘制数据线条时,将参数 `marker` 设置为 `None`,即:`marker=None`。这样,就不会显示数据点了。
相关推荐
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![docx](https://img-home.csdnimg.cn/images/20210720083331.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)