# The plot server must be running
# Go to http://localhost:5006/bokeh to view this plot

import time

from numpy import pi, cos, sin, linspace, roll, zeros_like

from bokeh.plotting import cursession, figure, show, output_server
from bokeh.models import GlyphRenderer

N = 50 + 1
r_base = 8
theta = linspace(0, 2*pi, N)
r_x = linspace(0, 6*pi, N-1)
rmin = r_base - cos(r_x) - 1
rmax = r_base + sin(r_x) + 1

colors = ["FFFFCC", "#C7E9B4", "#7FCDBB", "#41B6C4", "#2C7FB8", "#253494", "#2C7FB8", "#41B6C4", "#7FCDBB", "#C7E9B4"] * 5

cx = cy = zeros_like(rmin)

output_server("animated")

p = figure(x_range=[-11, 11], y_range=[-11, 11])

p.annular_wedge(
    cx, cy, rmin, rmax, theta[:-1], theta[1:],
    inner_radius_units="data",
    outer_radius_units="data",
    fill_color = colors,
    line_color="black",
)

show(p)

renderer = p.select(dict(type=GlyphRenderer))
ds = renderer[0].data_source

while True:

    rmin = ds.data["inner_radius"]
    rmin = roll(rmin, 1)
    ds.data["inner_radius"] = rmin

    rmax = ds.data["outer_radius"]
    rmax = roll(rmax, -1)
    ds.data["outer_radius"] = rmax

    cursession().store_objects(ds)
    time.sleep(.10)

@@ -30,61 +30,58 @@
 ning
-%0A# Go to http://localhost:5006/bokeh to view this plo
+ (%60bokeh serve%60) then run this script to push to i
 t%0A%0Ai
@@ -183,45 +183,51 @@
 ort 
-cursession, figure, show, output_s
+figure%0Afrom bokeh.models import GlyphRend
 er
-v
 er%0Af
@@ -232,38 +232,38 @@
 %0Afrom bokeh.
-models
+client
  import 
 GlyphRendere
@@ -250,29 +250,56 @@
  import 
-GlyphRenderer
+push_session%0Afrom bokeh.io import curdoc
 %0A%0AN = 50
@@ -587,34 +587,60 @@
 n)%0A%0A
-output_server(%22animated%22)%0A
+# figure() function auto-adds the figure to curdoc()
 %0Ap =
@@ -868,14 +868,154 @@
 %0A)%0A%0A
+# Open a session which will keep our local doc in sync with server%0Asession = push_session(curdoc())%0A%0A# Open the session in a browser%0Asession.
 show(
-p
 )%0A%0Ar
@@ -1089,16 +1089,84 @@
 source%0A%0A
+# These changes to our document will automatically go to the server%0A
 while Tr
@@ -1371,38 +1371,148 @@
     
-cursession().store_objects(ds)
+# TODO this is a Bokeh bug workaround: Document%0A    # doesn't notice that we assigned to 'ds.data'%0A    ds.trigger('data', ds.data, ds.data)%0A
 %0A   

Fix examples/plotting/server/animated.py, with one hacky workaround for now