如何在3D图中脱离网格

时间:2019-11-16 08:06:19

标签: python-3.x matplotlib 3d

我有一个3D图脚本:

import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
import numpy as np

fig = plt.figure(figsize=[5,3])
ax = fig.gca(projection = '3d')
ax.set_ylim(0,3)
ax.set_zlim(0,2)

我读过here

ax=gca()
ax[:set_axis_off]()

会有所帮助。如何应用?

我尝试过:

fig = plt.figure(figsize=[5,3])
ax = fig.gca(projection = '3d')
ax[:set_axis_off]()
ax.set_ylim(0,3)
ax.set_zlim(0,2)

有错误:

/usr/lib/python3.6/_collections_abc.py:841: MatplotlibDeprecationWarning: 
The text.latex.unicode rcparam was deprecated in Matplotlib 3.0 and will be removed in 3.2.
  self[key] = other[key]
Traceback (most recent call last):
  File "axes.py", line 16, in <module>
    ax[:set_axis_off]()
NameError: name 'set_axis_off' is not defined

1 个答案:

答案 0 :(得分:1)

example you found用于Julia编程语言。

Python的语法与此不同:ax.set_axis_off()