icoCNN icon indicating copy to clipboard operation
icoCNN copied to clipboard

TypeError: FigureBase.gca() got an unexpected keyword argument 'projection'

Open JuanFMontesinos opened this issue 2 years ago • 1 comments

Getting the following error:

Traceback (most recent call last):
  File "<string>", line 6, in <module>
  File "/home/jmt/.local/lib/python3.10/site-packages/icoCNN/plots.py", line 56, in icosahedral_scatter
    ax = plt.figure().gca(projection='3d')
TypeError: FigureBase.gca() got an unexpected keyword argument 'projection'

Which may be related to https://stackoverflow.com/questions/67095247/gca-and-latest-version-of-matplotlib

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().

Cheers Juan

JuanFMontesinos avatar Apr 20 '23 11:04 JuanFMontesinos

Hi Juan,

Thanks for reporting the bug and even finding which was the problem, it seems like it is indeed the same issue as in the stackoverflow question. I created a new branch that I think should fix the issue, but I cannot test it right now,. Could you install it with:

pip install https://github.com/DavidDiazGuerra/icoCNN/zipball/Fix-plt-issue-%232

and check if it works?

Best, David

DavidDiazGuerra avatar Apr 24 '23 07:04 DavidDiazGuerra