Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What happened to 'hold' in bokeh?

Tags:

python

bokeh

Lots of bokeh examples use the hold command. I can see from the documentation that it's been deprecated since version 0.8.0 So I tried this:

x = figure(x_axis_type = "datetime", tools=Tools)
x.hold()

but no joy...attribute 'hold' does not exist

How do I update such examples to work on recent versions of bokeh?

As pointed out below, the answer to this question: bokeh overlay multiple plot objects in a GridPlot says that hold is deprecated.

I think (from 3 seconds of experimentation), that hold commands can just be removed. Since I don't know what it was meant to do, I can't verify this is correct :-).

I would be good to have that confirmed here.

like image 973
Stefan Avatar asked Oct 20 '22 14:10

Stefan


1 Answers

Edit: just to clarify, this question and answer refer to the old hold() plotting function, removed several years ago, and not to the more recent (and completely unrelated) Document.hold() method for pausing server updates)

The bokeh.plotting API used to have a notion of an implicit "current plot". By default, every plotting function like circle or rect created a new plot. The hold function was intended to stop new plot creation, so multiple renderers could be added to the same plot. This was removed in favor of a more explicit interface that did not have a "current plot" notion. This provides more reliable interactions in the IPython notebook as well as server examples. To add multiple renderers on a single plot, it now looks like, for example:

p = figure(...)
p.circle(...)
p.rect(...)

Since all operations are now methods on explicit "plot" objects, there is no need for hold (so there is no replacement for it).

like image 130
bigreddot Avatar answered Nov 15 '22 02:11

bigreddot