Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

KeyError: 'scale' for import matplotlib.pyplot as plt

I'm getting KeyError: 'scale' when I'm trying to run import matplotlib.pyplot

I redownloaded the matplotlib then ran the code but still getting the same error.

I've also opened the new Jupyter notebook and only ran "import matplotlib.pyplot as plt" and I'm still getting the same error. I didn't get any error when I ran "import matplotlib" only.

I would be grateful if you help me out find what's causing the error.

import matplotlib.pyplot as plt
%matplotlib inline

city_pay_top50.plot(kind='bar', x='customer_city', y='payment_value')
plt.title('Cities with top 50 revenues')

plt.show()
KeyError                                  Traceback (most recent call last)
<ipython-input-6-07805b46bb32> in <module>
----> 1 import matplotlib.pyplot as plt
      2 #%matplotlib inline
      3 
      4 plt.bar(city_pay_top50['customer_city'], city_pay_top50['payment_value'])
      5 #city_pay_top50.plot(kind='bar', x='customer_city', y='payment_value')

~/opt/anaconda3/lib/python3.7/site-packages/matplotlib-3.2.1+1847.gfc8a2fa24-py3.7-macosx-10.9-x86_64.egg/matplotlib/pyplot.py in <module>
     41 from matplotlib import docstring
     42 from matplotlib.backend_bases import FigureCanvasBase, MouseButton
---> 43 from matplotlib.figure import Figure, figaspect
     44 from matplotlib.gridspec import GridSpec
     45 from matplotlib import rcParams, rcParamsDefault, get_backend, rcParamsOrig

~/opt/anaconda3/lib/python3.7/site-packages/matplotlib-3.2.1+1847.gfc8a2fa24-py3.7-macosx-10.9-x86_64.egg/matplotlib/figure.py in <module>
     15 
     16 import matplotlib as mpl
---> 17 from matplotlib import docstring, projections
     18 from matplotlib import __version__ as _mpl_version
     19 

~/opt/anaconda3/lib/python3.7/site-packages/matplotlib-3.2.1+1847.gfc8a2fa24-py3.7-macosx-10.9-x86_64.egg/matplotlib/projections/__init__.py in <module>
      2 from .geo import AitoffAxes, HammerAxes, LambertAxes, MollweideAxes
      3 from .polar import PolarAxes
----> 4 from mpl_toolkits.mplot3d import Axes3D
      5 
      6 

~/opt/anaconda3/lib/python3.7/site-packages/mpl_toolkits/mplot3d/__init__.py in <module>
----> 1 from .axes3d import Axes3D

~/opt/anaconda3/lib/python3.7/site-packages/mpl_toolkits/mplot3d/axes3d.py in <module>
     40 
     41 
---> 42 class Axes3D(Axes):
     43     """
     44     3D axes object.

~/opt/anaconda3/lib/python3.7/site-packages/mpl_toolkits/mplot3d/axes3d.py in Axes3D()
     50     def __init__(
     51             self, fig, rect=None, *args,
---> 52             azim=-60, elev=30, zscale=None, sharez=None, proj_type='persp',
     53             **kwargs):
     54         """

~/opt/anaconda3/lib/python3.7/site-packages/matplotlib-3.2.1+1847.gfc8a2fa24-py3.7-macosx-10.9-x86_64.egg/matplotlib/docstring.py in dedent_interpd(func)
     78     """Dedent *func*'s docstring, then interpolate it with ``interpd``."""
     79     func.__doc__ = inspect.getdoc(func)
---> 80     return interpd(func)

~/opt/anaconda3/lib/python3.7/site-packages/matplotlib-3.2.1+1847.gfc8a2fa24-py3.7-macosx-10.9-x86_64.egg/matplotlib/docstring.py in __call__(self, func)
     38     def __call__(self, func):
     39         if func.__doc__:
---> 40             func.__doc__ %= self.params
     41         return func
     42 

KeyError: 'scale'
like image 871
yasitski Avatar asked Sep 01 '26 23:09

yasitski


1 Answers

For those who may face the same error as me, the problem was solved by updating the version of Jupyter notebook to the latest version in my case.

like image 166
yasitski Avatar answered Sep 04 '26 13:09

yasitski



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!