

In following example, vbar() glyph is separated by an offset of 0.25 for each group of bars for a particular month.įig.vbar(x = dodge('products', -0.25, range = fig.x_range), top = 'Jan', The dodge() function introduces a relative offset for each bar plot thereby achieving a visual impression of group. Products = Ĭols = #,'navy', 'cyan']įig = figure(x_range = products, plot_width = 300, plot_height = 300)įig.vbar_stack(months, x = 'products', source = sales, color = cols,width = 0.5)Ī grouped bar plot is obtained by specifying a visual displacement for the bars with the help of dodge() function in ansform module. In following example, sales is a dictionary showing sales figures of three products in three months. To render a vertical (or horizontal) stacked bar using vbar_stack() or hbar_stack() function, set stackers property to list of fields to stack successively and source property to a dict object containing values corresponding to each field. To show each bar in different colour, set color property of vbar() function to list of color values.Ĭols = įig.vbar(x = langs, top = students, color = cols,width=0.5) With following example, a simple bar plot is displayed showing number of students enrolled for various courses offered.įrom otting import figure, output_file, showįig.vbar(x = langs, top = students, width = 0.5) Langs = įig = figure(x_range = langs, plot_width = 300, plot_height = 300) For example, to use strings in the given list for x axis − In order to use categorical data along either of axes, we need to specify a FactorRange to specify categorical dimensions for one of them. In the examples so far, the Bokeh plots show numerical data along both x and y axes. The figure object can be so configured by defining extra_x_range and extra_y_range properties It may be needed to show multiple axes representing varying ranges on a single plot figure. If there exists a power law relationship between x and y data series, it is desirable to use log scales on both axes. The bokeh plots show numerical data along both x and y axes.

In this chapter, we shall discuss about various types of axes.
