annotate example/iris.py @ 180:69543d62ae7a

more split stubbing
author Jeff Hammel <k0scist@gmail.com>
date Tue, 09 Aug 2016 14:34:31 -0700
parents 4372fb852384
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
171
4372fb852384 add example file
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
1 from bokeh.sampledata.iris import flowers
4372fb852384 add example file
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
2 from bokeh.plotting import *
4372fb852384 add example file
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
3
4372fb852384 add example file
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
4 output_file("iris.html", title="iris.py example")
4372fb852384 add example file
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
5
4372fb852384 add example file
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
6 colormap = {'setosa': 'red', 'versicolor': 'green', 'virginica': 'blue'}
4372fb852384 add example file
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
7
4372fb852384 add example file
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
8 flowers['color'] = flowers['species'].map(lambda x: colormap[x])
4372fb852384 add example file
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
9
4372fb852384 add example file
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
10 #setting the name kwarg will give this scatter plot a user
4372fb852384 add example file
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
11 #friendly id, and the corresponding embed.js will have a nice name
4372fb852384 add example file
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
12 #too
4372fb852384 add example file
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
13
4372fb852384 add example file
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
14 scatter(flowers["petal_length"], flowers["petal_width"],
4372fb852384 add example file
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
15 color=flowers["color"], fill_alpha=0.2, size=10, name="iris")
4372fb852384 add example file
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
16
4372fb852384 add example file
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
17 show()