close


安裝 pip & matplotlib &numpy &dateutil

pip install matplotlib
pip install matplotlib
pip install numpy
pip install dateutil

可能用到msvcp.dl

將 msvcp.ddl 放到C:\windows\system32

------------------------------------------------------------------------------------------

C:\Users\Chio\Downloads>pip install matplotlib-1.5.1-cp27-none-win32.whl
Processing c:\users\enli\downloads\matplotlib-1.5.1-cp27-none-win32.whl
Requirement already satisfied: pytz in c:\python27\lib\site-packages (from matplotlib==1.5.1)
Requirement already satisfied: numpy>=1.6 in c:\python27\lib\site-packages (from matplotlib==1.5.1)
Requirement already satisfied: python-dateutil in c:\python27\lib\site-packages (from matplotlib==1.5.1)
Requirement already satisfied: cycler in c:\python27\lib\site-packages (from matplotlib==1.5.1)
Requirement already satisfied: pyparsing!=2.0.4,>=1.5.6 in c:\python27\lib\site-packages (from matplotlib==1.5.1)
Requirement already satisfied: six>=1.5 in c:\python27\lib\site-packages (from python-dateutil->matplotlib==1.5.1)
Installing collected packages: matplotlib
Successfully installed matplotlib-1.5.1

C:\Users\Chio\Downloads>pip install numpy-1.12.0rc2-cp27-none-win32.whl
Processing c:\users\enli\downloads\numpy-1.12.0rc2-cp27-none-win32.whl
Installing collected packages: numpy
Successfully installed numpy-1.12.0rc2

------------------------------------------------------------------------------------------

檢查 :

import matplotlib.pyplot as plt1
print(dir(plt) == dir(plt1))

輸出:

True

------------------------------------------------------------------------------------------

測試

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

------------------------------------------------------------------------------------------

# -*- coding: utf-8 -*-
import numpy as np
import matplotlib.pyplot as plt

x = np.linspace(0, 10, 1000)
y = np.sin(x)
z = np.cos(x)
plt.figure(figsize=(8,4))
plt.plot(x,y,label="$sin(x)$",color="red",linewidth=2)
plt.plot(x,z,label="$cos(x)$",color="blue",linewidth=2)
plt.xlabel("Time(s)")
plt.ylabel("Volt")
plt.title("PyPlot sin&cos Example")
plt.ylim(-1.2,1.2)
plt.legend()
plt.show()

arrow
arrow
    全站熱搜
    創作者介紹
    創作者 echochio 的頭像
    echochio

    echochio

    echochio 發表在 痞客邦 留言(0) 人氣()