Error when plotting using Matplotlib

695 views
Skip to first unread message

DaRobba

unread,
Nov 4, 2014, 5:27:13 AM11/4/14
to pyth...@googlegroups.com
Hi,

I get the following error with this piece of code:
Does anyone have any ideas as to what I'm doing wrong. Please note I am totally and completely new to Python programming.
Thank you


import matplotlib.pyplot
plt.plot([1,2,3,4],[4,7,8,12]   )
plt.ylabel('some numbers')
plt.show()

--------------------------------------------------


Traceback (most recent call last):
  File "C:\Python27\test.py", line 2, in <module>
    import matplotlib.pyplot
  File "C:\Python27\lib\site-packages\matplotlib\pyplot.py", line 29, in <module>
    from matplotlib.figure import Figure, figaspect
  File "C:\Python27\lib\site-packages\matplotlib\figure.py", line 36, in <module>
    from matplotlib.axes import Axes, SubplotBase, subplot_class_factory
  File "C:\Python27\lib\site-packages\matplotlib\axes\__init__.py", line 4, in <module>
    from ._subplots import *
  File "C:\Python27\lib\site-packages\matplotlib\axes\_subplots.py", line 10, in <module>
    from matplotlib.axes._axes import Axes
  File "C:\Python27\lib\site-packages\matplotlib\axes\_axes.py", line 18, in <module>
    from matplotlib.cbook import _string_to_bool, mplDeprecation
ImportError: cannot import name _string_to_bool

stone...@gmail.com

unread,
Nov 16, 2014, 3:59:08 PM11/16/14
to pyth...@googlegroups.com
Hi DaRobba,

You have a small error in your first line :

import matplotlib.pyplot as plt

plt.plot([1,2,3,4],[4,7,8,12]   )
plt.ylabel('some numbers')
plt.show()

Thomas george. c

unread,
Apr 15, 2016, 5:47:53 AM4/15/16
to python(x,y), stone...@gmail.com
The error is in  the import line itself.
I also am getting this error. It is telling that installing the "six" module will solve this, but after installing six module also, I am getting this error
Reply all
Reply to author
Forward
0 new messages