你可以通过设置 `ax.axis('off')` 来关闭 3D 图形的坐标轴和刻度线,从而让线条和数字不显示。修改后的代码如下:
```python
import matplotlib.pyplot as plt
from matplotlib import cm
from mpl_toolkits.mplot3d import Axes3D
fig = plt.figure()
ax = fig.add_subplot(projection='3d')
# 将坐标轴和刻度线关闭
ax.axis('off')
# 绘制图形
plt.show()
```
这样就可以只显示 3D 图形本身,而不显示坐标轴和刻度线了。