0

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.

Stücke
  • 868
  • 3
  • 14
  • 41
  • 1
    Maybe you created a file 'squarify.py' in the current directory? That way, `import squarify` might import that local file instead of the library. Renaming the local file might help. – JohanC Jan 05 '21 at 13:36
  • Indeed my file was caled squarify.py ... your solution works!! Thank you so much! :) I suggest you post that as an answer! :) – Stücke Jan 05 '21 at 13:40

0 Answers0