bokeh overlay multiple plot objects in a GridPlot

后端 未结 2 937
孤街浪徒
孤街浪徒 2021-01-06 10:10

Say I have a class that holds some data and implements a function that returns a bokeh plot

import bokeh.plotting as bk
class Data():
    def plot(self,**kwa         


        
2条回答
  •  借酒劲吻你
    2021-01-06 10:34

    As of Bokeh 0.7 the plotting.py interface has been changed to be more explicit and hopefully this will make things like this simpler and more clear. The basic change is that figure now returns an object, so you can just directly act on those objects without having to wonder what the "currently active" plot is:

    p1 = figure(...)
    p1.line(...)
    p1.circle(...)
    
    p2 = figure(...)
    p2.rect(...)
    
    gp = gridplot([p1, p2])
    show(gp)
    

    Almost all the previous code should work for now, but hold, curplot etc. are deprecated (and issue deprecation warnings if you run python with deprecation warnings enabled) and will be removed in a future release.

提交回复
热议问题