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

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.bezier() Function

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

Syntax: bezier(x0, y0, x1, y1, cx0, cy0, cx1, cy1, *, line_alpha=1.0, line_cap=’butt’, line_color=’black’, line_dash=[], line_dash_offset=0, line_join=’bevel’, line_width=1, name=None, tags=[], **kwargs)

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

  • x0: This parameter is the x-coordinates of the starting points.
  • y0: This parameter is the y-coordinates of the starting points.
  • x1: This parameter is the x-coordinates of the ending points.
  • y1: This parameter is the y-coordinates of the ending points.
  • cx0: This parameter is the x-coordinates of the first control points.
  • cy0: This parameter is the y-coordinates of the first control points.
  • cx1: This parameter is the x-coordinates of the second control points.
  • cy1: This parameter is the y-coordinates of the second control points.
  • line_alpha: This parameter is the line alpha values for the steps with default value of 1.0 .
  • line_cap: This parameter is the line cap values for the steps with default value of butt.
  • line_color: This parameter is the line color values for the steps with default value of black.
  • line_dash: This parameter is the line dash values for the steps with default value of [].
  • line_dash_offset: This parameter is the line dash offset values for the steps with default value of 0.
  • line_join: This parameter is the line join values for the steps with default value of bevel.
  • line_width: This parameter is the line width values for the steps 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.

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.bezier() function in bokeh.plotting:
Example 1:

filter_none

edit
close

play_arrow

link
brightness_4
code

# 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.bezier(x0 =[1, 2, 3], y0 =[3, 2, 1], 
            x1 =[1.4, 2.3, 3.5], y1 =[3.4, 2.3, 1.5], 
            cx0 =[1.4, 2.3, 3.5], cy0 =[3.4, 2.3, 1.5],
            cx1 =[.4, 1.3, 2.5], cy1 =[2.4, 1.3, .5],
            color ="green", alpha = 0.6, line_width = 3)
   
show(plot)

chevron_right


Output:

Example 2:

filter_none

edit
close

play_arrow

link
brightness_4
code

# Implementation of bokeh function
   
import numpy as np 
from bokeh.plotting import figure, output_file, show
   
N = 9
x = np.linspace(-2, 2, N)
y = x**2
  
xp02 = x + 0.4
xp01 = x + 0.1
xm01 = x-0.1
yp01 = y + 0.2
ym01 = y-0.2
  
plot = figure(plot_width = 300, plot_height = 300)
  
plot.bezier(x0 = x, y0 = y,
            x1 = xp02, y1 = y,
            cx0 = xp01, cy0 = yp01,
            cx1 = xm01, cy1 = ym01, 
            color ="green", alpha = 0.6,
            line_width = 3)
   
show(plot)

chevron_right


Output:

Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.

To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course.




My Personal Notes arrow_drop_up

Small things always make you to think big

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.


Article Tags :

Be the First to upvote.


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.