0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

fig.gca(projection='3d')で「unexpected keyword」エラーになった時の解決法

0
Posted at

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。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?