iris#

A scatter plot using Fisher’s Iris dataset. This example demonstrates manual color mapping with basic plot elements. The chart shows correlation between petal width and length for three different iris species.

Note

This example is maintained for historical compatibility. Please consider alternatives to Iris, such as penguins.

Details

Sampledata:

bokeh.sampledata.iris

Bokeh APIs:

figure.scatter

More info:

Scatter markers

Keywords:

alpha, colormap, scatter

from bokeh.plotting import figure, show
from bokeh.sampledata.iris import flowers

colormap = {'setosa': 'red', 'versicolor': 'green', 'virginica': 'blue'}
colors = [colormap[x] for x in flowers['species']]

p = figure(title="Iris Morphology")
p.xaxis.axis_label = 'Petal Length'
p.yaxis.axis_label = 'Petal Width'

p.scatter(flowers["petal_length"], flowers["petal_width"],
          color=colors, fill_alpha=0.2, size=10)

show(p)