示例#1
0
文件: census.py 项目: GoldSachs/bokeh
from bokeh.plotting import figure, output_server, show
from bokeh.models import ServerDataSource
import bokeh.transforms.ar_downsample as ar
from blaze.server.client import Client
from blaze import Data
output_server("Census")
# 2010 US Census tracts

c = Client('http://localhost:5006')
d = Data(c)
source = ServerDataSource()
source.from_blaze(d.census, local=True)

plot = figure()
arplot = plot.square(
            'LON', 'LAT',
            source=source,
            plot_width=600,
            plot_height=400,
            title="Census Tracts")

ar.heatmap(arplot, palette="Reds9", reserve_val=0, points=True, client_color=True, title="Census Tracts (Client Colors)")
ar.heatmap(arplot, low=(255, 200, 200), points=True, title="Census Tracts (Server Colors)")
ar.contours(arplot, title="ISO Contours")
show(plot)
示例#2
0
from bokeh.plotting import figure, output_server, show
from bokeh.models import ServerDataSource

import bokeh.transforms.ar_downsample as ar
from blaze.server.client import Client
from blaze import Data

output_server("abstractrender")

c = Client('http://localhost:5006')
d = Data(c)
source = ServerDataSource()
source.from_blaze(d.gauss, local=True)

plot = figure()
plot.square('oneA', 'oneB', color='#FF00FF', source=source)


#Server-side colored heatmap
arplot = ar.heatmap(plot, spread=3, transform=None, title="Server-rendered, uncorrected")

arplot = ar.heatmap(plot, spread=3, transform="Log", title="Server-rendered, log transformed")
arplot =  ar.heatmap(plot, spread=3, title="Server-rendered, perceptually corrected")

ar.replot(plot,
          agg=ar.Count(),
          info=ar.Const(val=1),
          shader=ar.Spread(factor=3) + ar.Cuberoot() + ar.InterpolateColor(low=(255,200,200), high=(255,0,0)),
          points=True,
          title="Manually process: perceptually corrected",
          reserve_val=0)
from bokeh.plotting import figure, output_server, show
from bokeh.models import ServerDataSource
import bokeh.transforms.ar_downsample as ar
from blaze.server.client import Client
from blaze import Data
output_server("Census")
# 2010 US Census tracts

c = Client('http://localhost:5006')
d = Data(c)
source = ServerDataSource()
source.from_blaze(d.census, local=True)

plot = figure()
arplot = plot.square('LON',
                     'LAT',
                     source=source,
                     plot_width=600,
                     plot_height=400,
                     title="Census Tracts")

ar.heatmap(arplot,
           palette="Reds9",
           reserve_val=0,
           points=True,
           client_color=True,
           title="Census Tracts (Client Colors)")
ar.heatmap(arplot,
           low=(255, 200, 200),
           points=True,
           title="Census Tracts (Server Colors)")