Python Matplotlib で描く各種プロット

Python Matplotlib

2016 ver.0.06

matplotlib python 2 3 (ffmpeg ) Excel

matplotlib matplotlib doc PDF 2,800 python matplotlib

matplotlib matplotlib Gallery Matplotlib Examples

1

matplotlib

2

2

pyplot

2

2.1 1 . . . . . . . . . . . . . . . . . . . . . . . . 2

2.2 . . . . . . . . . . . . . . . . . . . . . . . . . . . 3

2.3 --numpy . . . . . . . . . . . . . . . . . . 4

2.4 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5

3 3.1 3.2 3.3 3.4 3.5

numpy

6

numpy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11

A matplotlib

13

1

1 matplotlib

matplotlib Python matplotlib numpy matplotlib Installing A

2 pyplot

matplotlib 1 matplotlib.pyplot ' matplotlib.pyplot' plt import

import numpy as np import matplotlib.pyplot as plt

numpy ns

2.1 1

[Kg] [cm] x1, y1 x2, y2 x3, y3 3 xy- plt 3 (x1, y1), (x2, y2) (x3, y3) simple plot00.py

[ 1] 1 MacOX/Linux shell Shebang Windows (windows10) [ 2] 2 UTF-8 UTF-8 7

simple plot00.py 1 #!/usr/bin/env python 2 # -*- coding: utf-8 -*3 # .matplotlib/matplotlibrc 4 # font.family : IPAexGothic 5 # IPAex 6 ''' 7 simple_plot00.py 8 1 3 9 ''' 10 import matplotlib.pyplot as plt 11 12 plt.plot(62, 173, 'ro') 13 plt.plot(53, 163, 'ro') 14 plt.plot(72, 170, 'ro') 15 plt.xlim(50, 80) 16 plt.ylim(150, 180) 17 plt.xlabel(u' [Kg]') 18 plt.ylabel(u' [cm]') 19 plt.title(u' ') 20 #plt.savefig('image/simple_plot00.png') 21 plt.show()

12,13,14 plt.plot(xk, yk, 'ro') x, y- xk yk (xk, yk) 1 'ro' red circle() 15 x-16 y-

2

17,18,19 x- y- plt.xlabel( ) plt.ylabel( ) plt.title( ) 21 plt.show()

20 PNG .png(PNG), .pdf(PDF), .eps(EPS), .svg(SVG) JPEG

2.1 simple plot00.py 1

1 simple plot00.py IPAex .matplotlib/matplotlibrc

2.2 simple plot00.py 15 plt.axis

2.2

simple plot00.py 1 plot n (x1, y1), (x2, y2), (x3, y3), . . . , (xn, yn) x y 2 xlist, ylist

xlist = [x1, x2, x3, . . . , xn] ylist = [y1, y2, y3, . . . , yn]

simple plot0.py simple plot00.py 2

1 #!/usr/bin/env python 2 # -*- coding: utf-8 -*3 ''' 4 simple_plot0.py 5 3 xy- 6 ''' 7 import matplotlib.pyplot as plt 8

simple plot0.py

3

9 xlist = [62, 53, 72] 10 ylist = [173, 163, 170] 11 plt.plot(xlist, ylist, 'ro') 12 plt.xlim(50, 80) 13 plt.ylim(150, 180) 14 plt.xlabel(u' [Kg]') 15 plt.ylabel(u' [cm]') 16 plt.title(u' ') 17 #plt.savefig('image/simple_plot0.png') 18 plt.show()

2.3 simple plot0.py simple plot00.py

2.3 --numpy

matplotlib x- y- f (x) I = [xa, xb] I

xa = x0 < x1 < x2 < x3 < ? ? ? < xn-1 < xn = xb

xk f (xk) (xk, f (xk)), k = 0, . . . , n 2 f (x) = x2 [-2, 2] 0.25 2.3

matplotlib func plot0.py Python range xrange 9 15 frange(startpt, endpt, step) 17 startpt endpt step xlist 18 21 2 flist

func plot0.py

1 #!/usr/bin/env python

2 # -*- coding: utf-8 -*-

3 '''

4 func_plot0.py 5 numpy

6 '''

7 import matplotlib.pyplot as plt

8

9 def frange(startpt, endpt, step):

10

nlist = [startpt]

11

next = startpt + step

4

12

while next ................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download