Scatter plots#

Scatter markers#

Bokeh includes a large variety of markers for creating scatter plots. For example, to render circle scatter markers on a plot, use the circle() method of figure():

from bokeh.plotting import figure, show

p = figure(width=400, height=400)

# add a scatter circle renderer with a size, color, and alpha
p.scatter([1, 2, 3, 4, 5], [6, 7, 2, 4, 5], size=20, color="navy", alpha=0.5)

# show the results
show(p)

Similarly, use the square() method of figure() to scatter square markers on a plot:

from bokeh.plotting import figure, show

p = figure(width=400, height=400)

# add a square scatter renderer with a size, color, and alpha
p.scatter([1, 2, 3, 4, 5], [6, 7, 2, 4, 5], marker="square",
          size=20, color="olive", alpha=0.5)

# show the results
show(p)

Bokeh’s built-in scatter markers consist of a set of base markers, most of which can be combined with different kinds of additional visual features. This is an overview of all available scatter markers:

To see details and example plots for any of the available scatter markers, click on the corresponding glyph method in the following list:

All the markers have the same set of properties: x, y, size (in screen units), and angle (in radians by default). The circle() marker is an exception: this method accepts an additional radius property that you can use with data units.

Image URLs#

It is also possible to make scatter plots using arbitrary images for markers using the image_url() glyph method. The example below demonstrates using a single image, but it is possible to pass a column of differnet URLs for every point.

Note

The URLs must be accessible by HTTP or HTTPS. For security reasons, browsers will not allow loading local (file://) images into HTML canvas elements. For similar reasons, if the page is HTTPS, then the URLs for the images must also be HTTPS.