Open In App

bokeh.plotting.figure.circle() function in Python

Improve
Improve
Like Article
Like
Save
Share
Report

Bokeh is a data visualization library in Python that provides high-performance interactive charts and plots and the output can be obtained in various mediums like notebook, html and server. The Figure Class create a new Figure for plotting. It is a subclass of Plot that simplifies plot creation with default axes, grids, tools, etc.

bokeh.plotting.figure.circle() Function

The circle() function in plotting module of bokeh library is used to Configure and add Circle glyphs to this Figure.

Syntax: circle(x, y, *, angle=0.0, angle_units=’rad’, fill_alpha=1.0, fill_color=’gray’, line_alpha=1.0, line_cap=’butt’, line_color=’black’, line_dash=[], line_dash_offset=0, line_join=’bevel’, line_width=1, name=None, radius=None, radius_dimension=’x’, radius_units=’data’, size=4, tags=[], **kwargs)

Parameters: This method accept the following parameters that are described below:

  • x: This parameter is the x-coordinates for the center of the markers.
  • y: This parameter is the y-coordinates for the center of the markers.
  • angle: This parameter is the angles to rotate the markers.
  • fill_alpha: This parameter is the fill alpha values for the markers.
  • fill_color: This parameter is the fill color values for the markers.
  • line_alpha: This parameter is the line alpha values for the markers with default value of 1.0 .
  • line_cap: This parameter is the line cap values for the markers with default value of butt.
  • line_color: This parameter is the line color values for the markers with default value of black.
  • line_dash: This parameter is the line dash values for the markers with default value of [].
  • line_dash_offset: This parameter is the line dash offset values for the markers with default value of 0.
  • line_join: This parameter is the line join values for the markers with default value of bevel.
  • line_width: This parameter is the line width values for the markers with default value of 1.
  • mode: This parameter can be one of three values : [“before”, “after”, “center”].
  • name: This parameter is the user-supplied name for this model.
  • tags: This parameter is the user-supplied values for this model.
  • radius: This parameter is the radius values for circle markers .
  • radius_dimension: This parameter is the dimension to measure circle radii along.
  • size: This parameter is the size (diameter) values for the markers in screen space units.

Other Parameters: These parameters are **kwargs that are described below:

  • alpha: This parameter is used to set all alpha keyword arguments at once.
  • color: This parameter is used to to set all color keyword arguments at once.
  • legend_field: This parameter is the name of a column in the data source that should be used or the grouping.
  • legend_group: This parameter is the name of a column in the data source that should be used or the grouping.
  • legend_label: This parameter is the legend entry is labeled with exactly the text supplied here.
  • muted: This parameter contains the bool value.
  • name: This parameter is the optional user-supplied name to attach to the renderer.
  • source: This parameter is the user-supplied data source.
  • view: This parameter is the view for filtering the data source.
  • visible: This parameter contains the bool value.
  • x_range_name: This parameter is the name of an extra range to use for mapping x-coordinates.
  • y_range_name: This parameter is the name of an extra range to use for mapping y-coordinates.
  • level: This parameter specify the render level order for this glyph.

Return: This method return the GlyphRenderer value.

Below examples illustrate the bokeh.plotting.figure.circle() function in bokeh.plotting:
Example 1:




# Implementation of bokeh function
   
import numpy as np 
from bokeh.plotting import figure, output_file, show
   
plot = figure(plot_width = 300, plot_height = 300)
plot.circle(x = [1, 2, 3], y = [3, 7, 5], 
            size = 20, color ="green", alpha = 0.6)
   
show(plot)


Output:

Example 2:




# Implementation of bokeh function
   
import numpy as np 
from bokeh.plotting import figure, output_file, show
   
x = [1, 2, 3, 4, 5]
y = [6, 7, 8, 7, 3]
  
output_file("geeksforgeeks.html")
  
p = figure(plot_width = 300, plot_height = 300)
  
# add both a line and circles on the 
# same plot
p.line(x, y, line_width = 2)
p.circle(x, y, fill_color ="red"
         line_color ="green", size = 8)
  
show(p)


Output:



Last Updated : 17 Jun, 2020
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads