Skip to content

Instantly share code, notes, and snippets.

@quasiben
Created May 8, 2014 19:15
Show Gist options
  • Save quasiben/b71954485dceaf0f0ce2 to your computer and use it in GitHub Desktop.
Save quasiben/b71954485dceaf0f0ce2 to your computer and use it in GitHub Desktop.
import numpy as np
from bokeh.plotting import *
output_notebook()
def dscatter(color="black"):
def decorator(fn):
x,y = fn()
scatter(x,y, color=color, tools="pan,wheel_zoom,box_zoom,reset,resize")
show()
return decorator
@dscatter("red")
def sin_func():
N = 100
x = np.linspace(0, 4*np.pi, N)
y = np.sin(x)
return x,y
sin_func()
@spearsem
Copy link

spearsem commented May 8, 2014

The other problem that this solves is providing a nice developer guide / hooks for splicing in any other visualization tools out there. If you want your maps to render with Google Charts API, you just wrap the needed pandas->javascript array conversion in a document that calls Google Charts API stuff. If you want the bleeding edge of some new library, you just wrap it.

As far as Bokeh team would be concerned, it would mean we wrap anything and everything -- and especially anything that users request. Or maybe make an engine that absorbs formatted .js code and automatically creates a 'provider' out of it.

For casual users, they will just make use of whatever is built in and shipped with Bokeh. But for other vis developers, it would represent a wole system by which you can "script" a web app directly in Python, leaving off only as much javascript as precisely what's needed for the charts at hand.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment