Matplotlib

[Pages:88]matplotlib

#matplotlib

1

1: matplotlib

2

2

2

2

Examples

2

2

Windows

2

OS X

2

2

/

2

/

2

2

matplotlib

3

5

2

6

2: 3

8

8

Examples

11

3

11

3: LogLog Graphing

13

13

Examples

13

LogLog

13

4: TeX / LaTeX

16

16

Examples

16

TeX

16

TeX

18

5:

20

20

Examples

20

pyplot

20

plt.close ()

20

6:

21

Examples

21

21

21

22

23

23

24

25

25

26

27

28

7:

32

Examples

32

32

32

33

8:

35

35

Examples

35

35

/

36

gridspec

38

x .

39

40

9:

48

Examples

48

48

48

10:

50

Examples

50

50

11:

52

Examples

52

52

12:

58

58

Examples

58

FuncAnimation

58

GIF

59

matplotlib.widgets

60

matplotlib .

61

13:

64

Examples

64

64

14:

66

Examples

66

66

67

70

70

15:

71

71

Examples

71

71

16:

74

Examples

74

74

76

77

79

17:

81

Examples

81

81

81

18:

82

Examples

82

82

83

You can share this PDF with anyone you feel could benefit from it, downloaded the latest version from: matplotlib

It is an unofficial and free matplotlib ebook created for educational purposes. All the content is extracted from Stack Overflow Documentation, which is written by many hardworking individuals at Stack Overflow. It is neither affiliated with Stack Overflow nor official matplotlib.

The content is released under Creative Commons BY-SA, and the list of contributors to each chapter are provided in the credits section at the end of this book. Images may be copyright of their respective owners unless otherwise specified. All trademarks and registered trademarks are the property of their respective company owners.

Use the content presented in this book at your own risk; it is not guaranteed to be correct nor accurate, please send your feedback and corrections to info@



1

1: matplotlib

matplotlib Python . API . MATLAB . JDHunter . BSD .

Python 1.3.1 2.6, 2.7, 3.x 1.4.3 2.6, 2.7, 3.x 1.5.3 2.7, 3.x 2.x 2.7, 3.x

2013-10-10 2015-07-14 2016-01-11 2016-07-25

Examples

matplotlib , . matplotlib .

Windows

Windows pip matplotlib . Windows pip .

OS X

pip matplotlib . non-Python ( : libfreetype ) homebrew . pip .

python-matplotlib pip install matplotlib pip install matplotlib matplotlib pip .

( , sudo ), --user

: python setup.py install --user . ~/.local matplotlib .

/

sudo apt-get install python-matplotlib

/

sudo yum install python-matplotlib



2

matplotlib matplotlib .

matplotlib

import pylab as plt import numpy as np

plt.style.use('ggplot')

fig = plt.figure(1) ax = plt.gca()

# make some testing data x = np.linspace( 0, np.pi, 1000 ) test_f = lambda x: np.sin(x)*3 + np.cos(2*x)

# plot the test data ax.plot( x, test_f(x) , lw = 2)

# set the axis labels ax.set_xlabel(r'$x$', fontsize=14, labelpad=10) ax.set_ylabel(r'$f(x)$', fontsize=14, labelpad=25, rotation=0)

# set axis limits ax.set_xlim(0,np.pi)

plt.draw()



3

................
................

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

Google Online Preview   Download