pytudes icon indicating copy to clipboard operation
pytudes copied to clipboard

Pin matplotlib version in requirements.txt or drop usage of hold to avoid AttributeError

Open jhadjar opened this issue 5 years ago • 0 comments

Summary:


Running the notebook ipynb/Economics.ipynb raises an AttributeError exception with matplotlib-3.1.3 installed.

Reproduce:


  • Run the notebook with a matplotlib version that deprecated hold

Actual outcome:


An AttributeError exception is raised.

Expected outcome:


A sweet notebook running.

Logs &/or traceback:


Traceback

AttributeError Traceback (most recent call last) in ----> 1 show(population)

in show(population, k, percentiles, **kwargs) 19 plt.title('/'.join(map(str, percentiles)) + ' Percentile Plots') 20 times = [t for (t, pop) in results] -->21 plt.hold(True); plt.xlabel('wealth'); plt.ylabel('time'); plt.grid(True) 22 for pct in percentiles: 23 line = [percent(pct, pop) for (t, pop) in results]

AttributeError: module 'matplotlib.pyplot' has no attribute 'hold'

Likely parts and draft fix:


Change requirements.txt to pin the matplotlib version to something like 2.1.0:

numpy
matplotlib==2.1.0

Another option is to update the code in ipynb/Economics.ipynb to use the updated API.

jhadjar avatar Feb 22 '20 12:02 jhadjar