Good afternoon,
I am running Python 3.9.2 on my Mac (Mac OS Big Sur 11.2.3), and when running my code, that includes:
import matplotlib.pylab as plt
(...)
cm = plt.get_cmap('viridis')
cNorm = plt.colors.Normalize(vmin=min(forces), vmax=max(forces))
scalarMap = cmx.ScalarMappable(norm=cNorm, cmap=cm)
I get the error:
cNorm = plt.colors.Normalize(vmin=min(forces), vmax=max(forces))
AttributeError: module 'matplotlib.pylab' has no attribute 'colors'
I have tried uninstalling and installing matplotlib (both with conda and pip), and that didn't work. I tried installing different versions of matplotlib, and that didn't work either. I looked at this thread but it didn't answer my questions.
I don't understand what the issue is here, since the code was provided by my instructor, and since the error is for the second use of plt, the error is not with the import of matplotlib.
Please let me know if you know what the issue is, or what I could try to fix this. Thank you.