AttributeError: module ‘matplotlib. pyplot‘ has no attribute ‘ishold‘

created at 07-29-2021 views: 19

description

Error when using matplotlib.pyplot in jupyter notebook to compose a picture

Error: AttributeError: module'matplotlib. pyplot' has no attribute'ishold',

reason

This problem may be caused by a mismatch between the networkx and matplotlib versions, or the incorrect installation order of the two.

solution

1. uninstall networkx and matplotlib first

Open Anaconda Powershell Prompt

pip uninstall --user networkx

Wait until neyworkx is successfully uninstalled, then continue to uninstall matplotlib:

pip uninstall --user matplotlib

2. Install matplotlib and networkx again (note the order)

Still executed in Anaconda Powershell Prompt

pip install --user matplotlib

When matplotlib is successfully installed, you will find that it reminds that the networkx version needs to be >=2, which may be the main reason for the previous error.

Continue to install networkx

pip uninstall --user networkx

3 Restart jupyter notebook

run your own code and you will find that you can plot again.

created at:07-29-2021
edited at: 07-29-2021: