首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Python Windrose产生Affine2dbase错误

Python Windrose产生Affine2dbase错误
EN

Stack Overflow用户
提问于 2020-04-28 20:44:37
回答 1查看 161关注 0票数 0

我正在尝试一个简单的python windrose示例,从这里使用Anaconda2的Windrose Notebook Example。但我在运行下面的简单代码时收到错误消息'TypeError: unbound method __init__() must be called with Affine2DBase instance as first argument (got Affine2D instance instead)

代码语言:javascript
复制
from windrose import WindroseAxes
from matplotlib import pyplot as plt
import matplotlib.cm as cm
import numpy as np

ws = np.random.random(500) * 6
wd = np.random.random(500) * 360
ax = WindroseAxes.from_ax()

我正在努力理解我在网上找到的关于affine2dbase的信息,但我想这可能是我的matplotlib安装的问题?以下是我正在使用的版本

代码语言:javascript
复制
    matplotlib                2.2.3            py27h263d877_0
    matplotlib-base           2.2.5            py27h6595424_1    conda-forge
    windrose                  1.6.7                      py_1    conda-forge
    ipython                   5.8.0                    py27_0

下面是conda install infor for windrose以管理员身份安装:

代码语言:javascript
复制
(base) C:\WINDOWS\system32>conda install -c conda-forge windrose
Collecting package metadata (current_repodata.json): done
Solving environment: done

## Package Plan ##

  environment location: C:\Users\Student\Anaconda2

  added / updated specs:
    - windrose


The following NEW packages will be INSTALLED:

  python_abi         conda-forge/win-64::python_abi-2.7-1_cp27m

The following packages will be UPDATED:

  conda                       pkgs/main::conda-4.8.3-py27_0 --> conda-forge::conda-4.8.3-py27h8c360ce_1


Proceed ([y]/n)? y

Preparing transaction: done
Verifying transaction: done
Executing transaction: done

如果您能就如何修复windrose或者如何减轻affine2d错误提供建议,我将不胜感激。谢谢

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2020-04-29 21:00:48

正如@fyberoptik所建议的,解决方案是在conda提示符中使用pip install windrose。虽然在anaconda提示符中看起来没有任何变化,但windrose现在为测试数据和我自己的数据绘制了图。

代码语言:javascript
复制
(base) C:\Users\Student>pip install windrose
DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
Requirement already satisfied: windrose in c:\users\student\anaconda2\lib\site-packages (1.6.7)
    Requirement already satisfied: numpy in c:\users\student\anaconda2\lib\site-packages (from windrose) (1.16.5)
    Requirement already satisfied: matplotlib in c:\users\student\anaconda2\lib\site-packages (from windrose) (2.2.5)
    Requirement already satisfied: cycler>=0.10 in c:\users\student\anaconda2\lib\site-packages (from matplotlib->windrose) (0.10.0)
    Requirement already satisfied: pyparsing!=2.0.4,!=2.1.2,!=2.1.6,>=2.0.1 in c:\users\student\anaconda2\lib\site-packages (from matplotlib->windrose) (2.4.2)
    Requirement already satisfied: python-dateutil>=2.1 in c:\users\student\anaconda2\lib\site-packages (from matplotlib->windrose) (2.8.0)
    Requirement already satisfied: pytz in c:\users\student\anaconda2\lib\site-packages (from matplotlib->windrose) (2019.3)
    Requirement already satisfied: six>=1.10 in c:\users\student\anaconda2\lib\site-packages (from matplotlib->windrose) (1.12.0)
    Requirement already satisfied: kiwisolver>=1.0.1 in c:\users\student\anaconda2\lib\site-packages (from matplotlib->windrose) (1.1.0)
    Requirement already satisfied: backports.functools_lru_cache in c:\users\student\anaconda2\lib\site-packages (from matplotlib->windrose) (1.5)
    Requirement already satisfied: setuptools in c:\users\student\anaconda2\lib\site-packages (from kiwisolver>=1.0.1->matplotlib->windrose) (41.4.0)

使用标准示例:

代码语言:javascript
复制
ws = np.random.random(500) * 6
wd = np.random.random(500) * 360
ax = WindroseAxes.from_ax()
ax.bar(wd, ws)

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/61480486

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档