Bokeh, combination of bar and line chart -


i trying plot line on top of bar chart within bokeh. have tried:

p1 = figure()...  p1.renderer.append(bar(...)) p1.renderer.append(line(...))  show(p1) 

so far had no luck.

combination of 2 or more graphs in 1 plot in bokeh possible using basic glyphs.

for question can use line , rect.

from bokeh.plotting import figure, output_file, show bokeh.models.ranges import range1d import numpy   output_file("line_bar.html")  p = figure(plot_width=400, plot_height=400)  # add line renderer p.line([1, 2, 3, 4, 5], [6, 7, 6, 4, 5], line_width=2)  # setting bar values h = numpy.array([2, 8, 5, 10, 7])  # correcting bottom position of bars on 0 line. adj_h = h/2  # add bar renderer p.rect(x=[1, 2, 3, 4, 5], y=adj_h, width=0.4, height=h, color="#cab2d6")  # setting y  axis range    p.y_range = range1d(0, 12)  p.title = "line , bar"  show(p) 

and plot get:

enter image description here


Comments

Popular posts from this blog

Magento/PHP - Get phones on all members in a customer group -

php - .htaccess mod_rewrite for dynamic url which has domain names -

Website Login Issue developed in magento -