comparison example/iris.py @ 171:4372fb852384

add example file
author Jeff Hammel <k0scist@gmail.com>
date Thu, 02 Jul 2015 20:56:55 -0700
parents
children
comparison
equal deleted inserted replaced
170:31a004976411 171:4372fb852384
1 from bokeh.sampledata.iris import flowers
2 from bokeh.plotting import *
3
4 output_file("iris.html", title="iris.py example")
5
6 colormap = {'setosa': 'red', 'versicolor': 'green', 'virginica': 'blue'}
7
8 flowers['color'] = flowers['species'].map(lambda x: colormap[x])
9
10 #setting the name kwarg will give this scatter plot a user
11 #friendly id, and the corresponding embed.js will have a nice name
12 #too
13
14 scatter(flowers["petal_length"], flowers["petal_width"],
15 color=flowers["color"], fill_alpha=0.2, size=10, name="iris")
16
17 show()