171
|
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() |