python+numpy+scipy=matlab,抛弃matlab
2013-07-23 00:00
926 查看
摘要: 本文主要介绍如何利用python实现matlab的功能,实现这个功能要用到python的三个第三方库,基于的操作系统是archlinux。其他的系统也是同样的方法。
本文主要介绍如何利用python实现matlab的功能,实现这个功能要用到python的三个第三方库,基于的操作系统是archlinux。其他的系统也是同样的方法。
linux系统安装numpy,scipy,matplotlib如下:
windows系统安装numpy,scipy,matplotlib如下:
到Unofficial Windows Binaries for Python Extension Packages中找到相应的版本
的三个软件安装即可,具体过程和所有的windows安装一样
代码如下:
运行结果:
本文主要介绍如何利用python实现matlab的功能,实现这个功能要用到python的三个第三方库,基于的操作系统是archlinux。其他的系统也是同样的方法。
安装
pyhton:就到官网下载安装,很多linux下是本身就安装的。linux系统安装numpy,scipy,matplotlib如下:
<!--lang: shell--> #archlinux系统下 pacman -S python-numpy python-scipy python-matplotlib #ubuntu系统下 sudo apt-get install python-numpy python-scipy python-matplotlib
windows系统安装numpy,scipy,matplotlib如下:
到Unofficial Windows Binaries for Python Extension Packages中找到相应的版本
的三个软件安装即可,具体过程和所有的windows安装一样
实例
创建一个python的脚本,将下面代码复制好,运行后你会看到美丽的画面:代码如下:
<!--lang: python--> #!/usr/bin/env python """ Show how to make date plots in matplotlib using date tick locators and formatters. See major_minor_demo1.py for more information on controlling major and minor ticks """ from __future__ import print_function import datetime from pylab import figure, show from matplotlib.dates import MONDAY from matplotlib.finance import quotes_historical_yahoo from matplotlib.dates import MonthLocator, WeekdayLocator, DateFormatter date1 = datetime.date( 2002, 1, 5 ) date2 = datetime.date( 2003, 12, 1 ) # every monday mondays = WeekdayLocator(MONDAY) # every 3rd month months = MonthLocator(range(1,13), bymonthday=1, interval=3) monthsFmt = DateFormatter("%b '%y") quotes = quotes_historical_yahoo('INTC', date1, date2) if len(quotes) == 0: print ('Found no quotes') raise SystemExit dates = [q[0] for q in quotes] opens = [q[1] for q in quotes] fig = figure() ax = fig.add_subplot(111) ax.plot_date(dates, opens, '-') ax.xaxis.set_major_locator(months) ax.xaxis.set_major_formatter(monthsFmt) ax.xaxis.set_minor_locator(mondays) ax.autoscale_view() #ax.xaxis.grid(False, 'major') #ax.xaxis.grid(True, 'minor') ax.grid(True) fig.autofmt_xdate() show()
运行结果:
相关文章推荐
- Intel® MKL with Numpy, Scipy, Matlab, C#, Python, NAG and more
- Python-SciPyStack安装(NumPy & SciPy)
- [机器学习]Python中Numpy,Pandas,Matplotlib,Scipy,Seaborn介绍
- windows下Python机器学习依赖库安装——numpy、scipy、sklearn、xgboost、theano等
- python3.6安装numpy,scipy,matplotlib
- window下安装Python的机器学习包numpy+scipy+matplotlib+scikit-learn
- 给python安装numpy+scipy+sklearn
- Python 机器学习的开发环境搭建(numpy,scipy,matplotlib)
- Windows下Python3.5安装Numpy、Scipy
- Ubuntu-Python2.7安装 scipy,numpy,matplotlib
- 用scipy.io通过mat文件在Python和Matlab/Octave之间进行数据交换
- python3.5下如何安装numpy和scipy?
- Python配置第三方库numpy、scipy、theano
- Python Numpy Scipy搭建过程详解
- python Numpy,SciPy,MatplotLib,pandas安装流程
- windows下python安装Numpy和Scipy模块
- windows下python numpy,scipy,pandas 等模块的安装
- Ubuntu环境下完美安装python模块numpy,scipy,matplotlib
- python numpy笔记:给matlab使用者
- Win10 64位系统下Python 及 Numpy , matplotlib,scipy工具包的安装