在用matplotlib画3d图时遇到了这个警告:
MatplotlibDeprecationWarning: Calling gca() with keyword arguments was deprecated in Matplotlib 3.4. Starting two minor releases later, gca() will take no keyword arguments. The gca() function should only be used to get the current axes, or if no axes exist, create new axes with default keyword arguments. To create a new axes with non-default arguments, use plt.axes() or plt.subplot().ax = fig.gca(projection='3d')
产生这个警告的原因,主要是这句代码ax = fig.gca(projection='3d')
导致的,这个警告的意思是说,在后续Matplotlib 3.4版本中gca()关键字参数弃用了,这个地方通过改写为如下形式就解决了:ax = fig.add_subplot(projection='3d')