ValueError:“ transform”必须是“ matplotlib.transform.Transform”的实例

时间:2019-03-04 01:38:59

标签: python python-3.x matplotlib

我是这个名为python的新languaje的新用户,我正在尝试使用matplotlib

这是我的代码:

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

来自pyplot的简单示例,但是当我运行它时,它给出了以下日志

runfile('C:/Users/Alex/.spyder-py3/temp.py', wdir='C:/Users/Alex/.spyder-py3')
Traceback (most recent call last):

  File "<ipython-input-22-b33263e553df>", line 1, in <module>
    runfile('C:/Users/Alex/.spyder-py3/temp.py', wdir='C:/Users/Alex/.spyder-py3')

  File "C:\Users\Alex\Anaconda3\lib\site-packages\spyder_kernels\customize\spydercustomize.py", line 704, in runfile
    execfile(filename, namespace)

  File "C:\Users\Alex\Anaconda3\lib\site-packages\spyder_kernels\customize\spydercustomize.py", line 108, in execfile
    exec(compile(f.read(), filename, 'exec'), namespace)

  File "C:/Users/Alex/.spyder-py3/temp.py", line 2, in <module>
    plt.plot([1, 2, 3, 4])

  File "C:\Users\Alex\Anaconda3\lib\site-packages\matplotlib\pyplot.py", line 2811, in plot
    is not None else {}), **kwargs)

  File "C:\Users\Alex\Anaconda3\lib\site-packages\matplotlib\pyplot.py", line 935, in gca
    return gcf().gca(**kwargs)

  File "C:\Users\Alex\Anaconda3\lib\site-packages\matplotlib\pyplot.py", line 578, in gcf
    return figure()

  File "C:\Users\Alex\Anaconda3\lib\site-packages\matplotlib\pyplot.py", line 525, in figure
    **kwargs)

  File "C:\Users\Alex\Anaconda3\lib\site-packages\matplotlib\backend_bases.py", line 3217, in new_figure_manager
    fig = fig_cls(*args, **kwargs)

  File "C:\Users\Alex\Anaconda3\lib\site-packages\matplotlib\figure.py", line 361, in __init__
    self.bbox = TransformedBbox(self.bbox_inches, self.dpi_scale_trans)

  File "C:\Users\Alex\Anaconda3\lib\site-packages\matplotlib\transforms.py", line 1036, in __init__
    raise ValueError("'transform' must be an instance of "

ValueError: 'transform' must be an instance of 'matplotlib.transform.Transform'

我不知道我在使用python 3.7.1做错什么即时消息的人可以帮助我吗?

0 个答案:

没有答案