-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbasic-ipython-plotting.html
135 lines (99 loc) · 5.51 KB
/
basic-ipython-plotting.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
<!DOCTYPE html>
<html lang="en">
<head>
<link href="/images/favicon.png" rel="icon">
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>trvrm.github.io</title>
<link rel="stylesheet" type="text/css" href="/theme/css/flatly.min.css" />
<link rel="stylesheet" type="text/css" href="/theme/css/style.css" />
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.min.css" rel="stylesheet" />
<link href="/theme/css/pygments/tango.css" rel="stylesheet">
<meta name="tags" content="Python" />
<meta name="tags" content="IPython" />
</head>
<body>
<section class="hero is-primary">
<!-- Hero header: will stick at the top -->
<div class="hero-head">
<nav class="navbar ">
<div class="navbar-menu is-active">
<div class="navbar-end">
<a class="navbar-item" href="https://twitter.com/trvrm">
<span class="icon"> <i class="fa fa-twitter"></i> </span>
twitter
</a>
<a class="navbar-item" href="https://github.com/trvrm">
<span class="icon"> <i class="fa fa-github"></i> </span>
github
</a>
</div>
</div>
</div>
</div>
<!-- Hero content: will be in the middle -->
<div class="hero-body">
<div class="container has-text-centered">
<p class="title is-1">trvrm.github.io</p>
</div>
</div>
<div class="hero-foot">
<nav class="navbar ">
<div class="navbar-brand is-active">
<a href="/" class="navbar-item" >
trvrm.github.io
</a>
</div>
<div class="navbar-menu is-active">
<div class="navbar-start">
<a class="navbar-item " href="/category/database.html">Database</a>
<a class="navbar-item is-active " href="/category/software.html">Software</a>
<a class="navbar-item " href="/category/systems.html">Systems</a>
</div>
</div>
</nav>
</div>
</section>
<section class="section">
<div class="container has-text-centered">
<p class="title is-3">
<a href="/basic-ipython-plotting.html" rel="bookmark" title="Permalink to Basic IPython Plotting">
Basic IPython Plotting
</a>
</p>
<p class="subtitle is-5">
Tue 20 May 2014
</p>
</div>
<hr>
<div class="content ">
<p><strong>Things have changed a bit since IPython 1</strong></p>
<p>Now apparently we want to manually specify the use of inline matplotlib
rather than enable globally in the server.</p>
<p><a class="reference external" href="http://nbviewer.ipython.org/github/ipython/ipython/blob/1.x/examples/notebooks/Part%203%20-%20Plotting%20with%20Matplotlib.ipynb">http://nbviewer.ipython.org/github/ipython/ipython/blob/1.x/examples/notebooks/Part%203%20-%20Plotting%20with%20Matplotlib.ipynb</a></p>
<div class="highlight"><pre><span></span><span class="o">%</span><span class="n">matplotlib</span> <span class="n">inline</span>
</pre></div>
<div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">matplotlib.pyplot</span> <span class="kn">as</span> <span class="nn">plt</span>
<span class="kn">import</span> <span class="nn">numpy</span> <span class="kn">as</span> <span class="nn">np</span>
</pre></div>
<div class="highlight"><pre><span></span><span class="n">x</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">linspace</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">3</span><span class="o">*</span><span class="n">np</span><span class="o">.</span><span class="n">pi</span><span class="p">,</span> <span class="mi">500</span><span class="p">)</span>
<span class="n">plt</span><span class="o">.</span><span class="n">plot</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">np</span><span class="o">.</span><span class="n">sin</span><span class="p">(</span><span class="n">x</span><span class="o">**</span><span class="mi">2</span><span class="p">))</span>
<span class="n">plt</span><span class="o">.</span><span class="n">title</span><span class="p">(</span><span class="s1">'A simple chirp'</span><span class="p">);</span>
</pre></div>
<img alt="basic plotting example" src="Basic%20Plotting%20Example_files/Basic%20Plotting%20Example_3_0.png" />
</div>
</section>
<footer class="footer">
<div class="container">
<div class="content has-text-centered">
<p>
Powered by <a href="http://getpelican.com/">Pelican</a>, <a href="http://python.org">Python</a>,
and <a href="http://bulma.io/">Bulma</a>
</p>
<p class="subtitle is-6">Ubi Caritas et Amor, Deus Ibi Est</p>
</div>
</div>
</footer>
</body>
</html>