pyファイルを実行したところ
$ python main.py
Matplotlib is building the font cache; this may take a moment.
Traceback (most recent call last):
File "/{path}/main.py", line 28, in <module>
ax = fig.gca(projection='3d')
^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: FigureBase.gca() got an unexpected keyword argument 'projection'
おや…?
調べてみると
「キーワード引数を使用した gca() の呼び出しは、Matplotlib 3.4 で非推奨になりました。」
とのこと。
以下のように修正したらうまくいきました。
変更前
ax = fig.gca(projection='3d')
変更後
ax = fig.add_subplot(projection='3d')
これでOK。