Matplotlib

[Pages:87]matplotlib

#matplotlib

1

1: matplotlib

2

2

2

2

Examples

2

2

2

OS X.

2

Linux

2

Debian / Ubuntu

2

Fedora / Red Hat

2

3

matplotlib

3

5

2D

6

2: LogLog

8

8

Examples

8

LogLog

8

3:

11

11

Examples

14

14

4:

16

Examples

16

16

17

20

20

5:

21

21

Examples

21

FuncAnimation

21

gif

22

matplotlib.widgets

23

matplotlib

24

6:

27

Examples

27

27

7:

29

29

Examples

29

29

8:

32

Examples

32

32

32

33

34

34

35

36

36

37

38

39

9:

43

43

Examples

43

43

/

44

gridspec

46

x2

47

48

10:

56

Examples

56

56

56

11:

57

Examples

57

57

12:

59

Examples

59

Boxplot

59

13:

65

Examples

65

65

14:

66

Examples

66

66

66

67

15: TeX / LaTeX

69

69

Examples

69

TeX

69

TeX

71

16:

72

Examples

72

72

74

75

77

17:

79

Examples

79

79

79

18:

81

81

Examples

81

pyplot

81

plt.close

81

82

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

matplotlibPythonAPIMATLAB JDHunterBSD

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

2015714 2016111 2016725

Examples

matplotlibmatplotlib

Windowspipmatplotlib Windowspip

OS X.

pipmatplotlibPythonlibfreetype pip

Linux

pipmatplotlibpython-matplotlibpip install matplotlib sudo--user python setup.py install --user matplotlib~/.local

Debian / Ubuntu

sudo apt-get install python-matplotlib

Fedora / Red Hat



2

sudo yum install python-matplotlib

matplotlibmatplotlib

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