matplotlib 使用windrose包会产生Affine2dbase错误

cetgtptt  于 2022-11-15  发布在  其他
关注(0)|答案(1)|浏览(130)

我正在尝试一个简单的python windrose示例Windrose Notebook Example,使用Anaconda2。

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安装有问题。以下是我正在使用的版本

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

下面是以管理员身份安装windrose的conda安装信息:

(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错误。谢谢

9q78igpj

9q78igpj1#

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

(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)

使用标准示例:

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

相关问题