Rendering Circles

In order to add the circle glyph to your plot, we use the circle() method instead of the line() method used in the above example.

Circle(): We use this method to add a circle glyph to the plot. It takes x and y coordinates of the center as parameters. Apart from these, it takes parameters such as size, fill_color,fill_alpha,angle, line_color, line_alpha,radius,radius_dimensions,etc

Syntax:

p.circle(x, y, size, fill_color)

Criss_cross(): this method adds a circle glyph with a ‘+’ mark through the center of the circle and it takes x and y coordinates of the center.

Syntax:

p.circle_cross(x, y, size, fill_color, fill_alpha, line_width)

Circle_X(): This method adds a circle glyph with an ‘X’ mark through the center of the circle and it takes x and y coordinates of the center.

Syntax:

p.circle_x(x, y, size,fill_color, fill_alpha, line_width)

Code:

Python




from bokeh.plotting import figure, show
from bokeh.io import output_file
 
# prepare some data
x = [1, 2, 4, 6, 7]
y = [7, 6, 3, 9, 10]
 
# create a new plot with figure function
p = figure(title="Circle Glyph", plot_width=450, plot_height=400)
 
# create circle glyph
p.circle(x=x, y=y, size=25, fill_color="red")
p.circle_cross(x=[2, 4, 6, 8], y=[5, 8, 9, 11], size=25,
               fill_color="blue", fill_alpha=0.3, line_width=2)
p.circle_x(x=[4, 7, 2, 6], y=[7, 2, 4, 9], size=25,
           fill_color="green", fill_alpha=0.6, line_width=2)
 
# show the results
output_file('circle.html')
show(p)


Output: 

Glyphs in Bokeh

Bokeh is a library of Python which is used to create interactive data visualizations. In this article, we will discuss glyphs in Bokeh. But at first let’s see how to install Bokeh in Python.

Similar Reads

Installation

To install this type the below command in the terminal....

Plotting with glyphs

Usually, a plot consists of geometric shapes either in the form of a line, circle, etc. So, Glyphs are nothing but visual shapes that are drawn to represent the data such as circles, squares, lines, rectangles, etc....

Rendering Circles

...

Rendering Bars

...

Patch Glyph

In order to add the circle glyph to your plot, we use the circle() method instead of the line() method used in the above example....