示例#1
0
    def test_heatmap_recipe(self):
        source = ServerDataSource(data_url="fn://bivariate",
                                  owner_username="******")
        plot = square('A',
                      'B',
                      source=source,
                      plot_width=600,
                      plot_height=400,
                      title="Test Title")

        plot2 = ar_downsample.heatmap(plot,
                                      palette="Reds9",
                                      reserve_val=0,
                                      points=True,
                                      client_color=True,
                                      title="Test Title 2")
        source2 = self._find_source(plot2)

        self.assertEquals("Test Title 2", plot2.title)
        self.assertEquals(type(source2), ServerDataSource)

        transform = source2.transform
        self.assertEquals(type(transform['info']), ar_downsample.Const)
        self.assertEquals(type(transform['agg']), ar_downsample.Count)
        self.assertEquals(type(transform['shader']), ar_downsample.Seq)
        self.assertEquals(transform['shader'].out, "image")
    def test_heatmap_recipe(self):
        ar_downsample._loadAR()
        reset_output()
        sess = Session(client=app.test_client())
        output_server('Census', session=sess)
        source = ServerDataSource(expr={
            'op': 'Field',
            'args': [':leaf', 'bivariate']
        })
        plot = figure(plot_width=600, plot_height=400, title="Test Title")
        plot.square('A', 'B', source=source)

        plot2 = ar_downsample.heatmap(plot,
                                      palette="Reds9",
                                      reserve_val=0,
                                      points=True,
                                      client_color=True,
                                      title="Test Title 2")
        source2 = self._find_source(plot2)

        self.assertEquals("Test Title 2", plot2.title)
        self.assertEquals(type(source2), ServerDataSource)

        transform = source2.transform
        self.assertEquals(type(transform['info']), ar_downsample.Const)
        self.assertEquals(type(transform['agg']), ar_downsample.Count)
        self.assertEquals(type(transform['shader']), ar_downsample.Seq)
        self.assertEquals(transform['shader'].out, "image")
示例#3
0
    def test_heatmap_recipie(self):
        source = ServerDataSource(data_url="fn://bivariate", owner_username="******")
        plot = square('A', 'B',
                      source=source,
                      plot_width=600,
                      plot_height=400,
                      title="Test Title")

        plot2 = ar_downsample.heatmap(plot, palette=["Reds-9"], reserve_val=0, points=True, client_color=True, title="Test Title 2")
        source2 = self._find_source(plot2)

        self.assertEquals("Test Title 2", plot2.title)
        self.assertEquals(type(source2), ServerDataSource)

        transform = source2.transform
        self.assertEquals(type(transform['info']), ar_downsample.Const)
        self.assertEquals(type(transform['agg']), ar_downsample.Count)
        self.assertEquals(type(transform['shader']), ar_downsample.Seq)
        self.assertEquals(transform['shader'].out, "image")
示例#4
0
    def test_heatmap_recipe(self):
        ar_downsample._loadAR()
        reset_output()
        sess = Session(client=app.test_client())
        output_server('Census', session=sess)
        source = ServerDataSource(
            expr={'op': 'Field', 'args': [':leaf', 'bivariate']}
        )
        plot = figure(plot_width=600,
                      plot_height=400,
                      title="Test Title")
        plot.square('A', 'B', source=source)

        plot2 = ar_downsample.heatmap(plot, palette="Reds9", reserve_val=0, points=True, client_color=True, title="Test Title 2")
        source2 = self._find_source(plot2)

        self.assertEquals("Test Title 2", plot2.title)
        self.assertEquals(type(source2), ServerDataSource)

        transform = source2.transform
        self.assertEquals(type(transform['info']), ar_downsample.Const)
        self.assertEquals(type(transform['agg']), ar_downsample.Count)
        self.assertEquals(type(transform['shader']), ar_downsample.Seq)
        self.assertEquals(transform['shader'].out, "image")
示例#5
0
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)

# Client-side colored heatmap
# I think this has been broken for a while?
# ar.heatmap(plot, spread=3, client_color=True, palette="Reds9", title="Client-colored")
示例#6
0
from bokeh.plotting import square, output_server, show
from bokeh.objects import ServerDataSource
import bokeh.transforms.ar_downsample as ar

"""
In order to run this example, you have to execute
./bokeh-server -D remotedata

the remote data directory in the bokeh checkout has the sample data for this example

In addition, you must install ArrayManagement from this branch (soon to be master)
https://github.com/ContinuumIO/ArrayManagement
"""

output_server("Census")
# 2010 US Census tracts
source = ServerDataSource(data_url="/defaultuser/CensusTracts.hdf5", owner_username="******")
plot = square(
        'LON', 'LAT',
        source=source,
        plot_width=600,
        plot_height=400,
        title="Census Tracts")

ar.heatmap(plot, palette=["Reds-9"], reserve_val=0, points=True, client_color=True, title="Census Tracts (Client Colors)")
ar.heatmap(plot, low=(255, 200, 200), points=True, title="Census Tracts (Server Colors)")
ar.contours(plot, title="ISO Contours")
show()
示例#7
0
import numpy as np
from bokeh.plotting import square, output_server, image, show
from bokeh.models import ServerDataSource

import bokeh.transforms.ar_downsample as ar

output_server("abstractrender")
source = ServerDataSource(data_url="fn://gauss", owner_username="******")
plot = square('oneA', 'oneB', color='#FF00FF', source=source)

#Server-side colored heatmap
ar.heatmap(plot,
           spread=3,
           transform=None,
           title="Server-rendered, uncorrected")
ar.heatmap(plot,
           spread=3,
           transform="Log",
           title="Server-rendered, log transformed")
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)

# Client-side colored heatmap
示例#8
0
the remote data directory in the bokeh checkout has the sample data for this example

In addition, you must install ArrayManagement from this branch (soon to be master)
https://github.com/ContinuumIO/ArrayManagement
"""

output_server("Census")
# 2010 US Census tracts
source = ServerDataSource(data_url="/defaultuser/CensusTracts.hdf5",
                          owner_username="******")
plot = square('LON',
              'LAT',
              source=source,
              plot_width=600,
              plot_height=400,
              title="Census Tracts")

ar.heatmap(plot,
           palette=["Reds-9"],
           reserve_val=0,
           points=True,
           client_color=True,
           title="Census Tracts (Client Colors)")
ar.heatmap(plot,
           low=(255, 200, 200),
           points=True,
           title="Census Tracts (Server Colors)")
ar.contours(plot, title="ISO Contours")
show()
示例#9
0
import numpy as np
from bokeh.plotting import square, output_server, image, show
from bokeh.models import ServerDataSource

import bokeh.transforms.ar_downsample as ar

output_server("abstractrender")
source = ServerDataSource(data_url="fn://gauss", owner_username="******")
plot = square('oneA', 'oneB', color='#FF00FF', source=source)


#Server-side colored heatmap
ar.heatmap(plot, spread=3, transform=None, title="Server-rendered, uncorrected")
ar.heatmap(plot, spread=3, transform="Log", title="Server-rendered, log transformed")
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)

# Client-side colored heatmap
ar.heatmap(plot, spread=3, client_color=True, palette="Reds9", title="Client-colored")

# Contours come in the same framework, but since the results of the shader are lines you use a different plotting function...
colors = ["#C6DBEF", "#9ECAE1", "#6BAED6", "#4292C6", "#2171B5", "#08519C", "#08306B"]
ar.contours(plot, palette=colors, title="ISO Contours")