1200字范文,内容丰富有趣,写作的好帮手!
1200字范文 > python绘制风玫瑰图_用Python matplotlib 怎么画风向玫瑰图 能给出程序的

python绘制风玫瑰图_用Python matplotlib 怎么画风向玫瑰图 能给出程序的

时间:2019-08-30 17:47:09

相关推荐

python绘制风玫瑰图_用Python matplotlib 怎么画风向玫瑰图 能给出程序的

推荐答案

python安装(之前写过一篇关于python的安装,这里不重复介绍)

(1) 如何下载?百度---> Python官网

(2) 版本:python-3.4.3.amd64 exe文件直接点哦

(3) 目录:D:\Python34

为python配置了环境变量:D:\Python34\Scripts;D:\Python34

(4) 命令行输入:python 有反应表示成功

说明:matplotlib还没有匹配python3.5的版本,我的电脑为64位

0Python安装学习指南

软件包下载:

因为涉及到众多包的下载,以及其中的版本和电脑位数问题特介绍如下( 注意加粗的字体):

(1) numpy numpy-1.10.1+mkl-cp34-none-win_amd64.whl

(2) matplotlib matplotlib-1.4.3.win-amd64-py3.4b/matplotlib-1.4.3/windows/

(3) 依赖包:pyparsing、dateutil、scipy

声明:以上软件地址可自行百度搜索

附注:图一为matplotlib 、图二为numpy 下载界面的选择

软件包numpy的安装:

1 命令行输入【完整的路径=numpy 在你电脑的绝对路径】

pip install 完整的路径\numpy -1.10.1+mkl-cp34-none-win_amd64.

2 验证:python编辑下 python>>

from numpy import *

安装matplotlib:

matplotlib-1.4.3.win-amd64-py3.4

因为下载的是exe文件,点击一路执行即可

依赖包的安装:

在命令行里逐行输入如下命令:软件包的绝对路径

1 pip install 绝对路径\pyparsing-2.0.3-py3-none-any.whl

2 pip install 绝对路径\python_dateutil-2.4.2-py2.py3-none-any.whl

3 pip install 绝对路径\matplotlib依赖\scipy-0.16.0-cp34-none-win_amd64.whl

验证是否安装成功:

1 在python编辑状态下导入安装的包:

import matplotlib

import numpy

import scipy

import pyparsing

import matplotlib.pyplot as plt

2 如果缺少six

在安装完毕scipy之后把../Python34/Lib/site-packages/scipy/lib中的six.py six.pyc six.pyo三个文件拷贝到.../Python34/Lib/site-packages

案例1:

import matplotlib.pyplot as plt

x = [0, 1, 2, 3, 4, 5]

y = [0.1, 0.2, 0.2, 0.3, 0.2, 0.1]

y2 = [0.2, 0.2, 0.3, 0.2, 0.3, 0]

plt.plot(x, y, 'b', x, y2, 'g')

plt.show()

案例2:

import matplotlib.pyplot as plt

import math

x=[]

y=[]

num=0.0

while num < math.pi * 4:

y.append(math.sin(num))

x.append(num)

num += 0.1

plt.plot(x, y, 'b')

plt.show()

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。