-
-
Notifications
You must be signed in to change notification settings - Fork 67
/
Copy path2015-05-25-ipython-notebooks_getting-started.html
executable file
·74 lines (63 loc) · 2.02 KB
/
2015-05-25-ipython-notebooks_getting-started.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
---
name: Plotly Graphing Library
permalink: /python/v3/ipython-notebooks/getting-started/
description: Get started with IPython notebooks and Plotly for inline interactive graphing.
language: python/v3
layout: base
redirect_from:
- /python/ipython-notebooks/
- /ipython-notebooks/getting-started/
---
<h2>Getting started</h2>
<p>
Instructions on how to install Plotly's Python package can be found on the <a class="no_underline plot-blue" href="/python/getting-started">Plotly for Python getting started page</a>.
</p>
<section class="section">
<div class="content-box">
<h2 >Creating an interactive graph inside IPython notebook</h2>
<pre><code><!--
-->import plotly.plotly as py
from plotly.graph_objs import *
trace0 = Scatter(
x=[1, 2, 3, 4],
y=[10, 15, 13, 17]
)
trace1 = Scatter(
x=[1, 2, 3, 4],
y=[16, 5, 11, 9]
)
data = Data([trace0, trace1])
py.iplot(data, filename = 'basic-line')</code></pre>
</div>
</section>
<section class="section">
<div class="content-box">
<h2 >Converting a matplotlib graph into an interactive graph inside an IPython notebook</h2>
<pre><code class="python"><!--
-->import matplotlib.pyplot as plt
import numpy as np
import plotly.plotly as py
n = 50
x, y, z, s, ew = np.random.rand(5, n)
c, ec = np.random.rand(2, n, 4)
area_scale, width_scale = 500, 5
fig, ax = plt.subplots()
sc = ax.scatter(x, y, c=c,
s=np.square(s)*area_scale,
edgecolor=ec,
linewidth=ew*width_scale)
ax.grid()
py.iplot_mpl(fig)</code></pre>
</div>
</section>
<section class="section">
<div class="content-box">
<h2 >Embedding a Plotly graph inside an IPython notebook</h2>
<pre><code class="python"><!--
-->import plotly.tools as tls
tls.embed("https://plotly.com/~streaming-demos/4")</code></pre>
</div>
</section>
<div class="row btnrow">
<a href="/ipython-notebooks/gallery" class="button">Notebook Gallery</a>
</div>