Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
520 views
in Technique[技术] by (71.8m points)

python - AttributeError: module 'squarify' has no attribute 'plot'

A piece of code to create a treemap which worked before does not work any longer. I am using Spyder IDE which I installed together with Anaconda.

import matplotlib.pyplot as plt
import squarify

squarify.plot(
    sizes=[13,22,35,5],
    label=["group A", "group B", "group C", "group D"],
    )
 
plt.axis('off')
plt.show()

When I run the code it throws the following error:

AttributeError: module 'squarify' has no attribute 'plot'

I don't know what I have changes that the code is not working any longer. I can run other matplotlib

*** Update *** I found a source suggesting I should run pip3 install -U matplotlib which yields another error

WARNING: Error parsing requirements for descartes: [Errno 2] No such file or directory: 'c:\users\USER\anaconda3\envs\uba\lib\site-packages\descartes-1.1.0.dist-info\METADATA'

I was able to fix this error by deleting the folder descartes-1.1.0.dist-info and reinstalling descartes. However, the initial squairy error persists.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...