コード例 #1
0
    def test_source(self):
        ar_downsample._loadAR()
        sess = Session(client=app.test_client())
        output_server('Census', session=sess)
        source = ServerDataSource(
            expr={'op': 'Field', 'args': [':leaf', 'bivariate']}
        )

        plot = figure()
        plot.square('A', 'B', source=source)

        agg = ar_downsample.CountCategories()
        info = ar_downsample.Const(val=1)
        shader = ar_downsample.InterpolateColor()

        new_source = ar_downsample.source(plot, agg=agg, info=info, shader=shader)
        self.assertIsNotNone(new_source.transform)
        trans = new_source.transform

        self.assertEquals(trans['resample'], 'abstract rendering')
        self.assertEquals(trans['agg'], agg)
        self.assertEquals(trans['info'], info)
        self.assertEquals(trans['shader'], shader)
        self.assertEquals(trans['glyphspec'],
                          plot.select({'type' : GlyphRenderer})[0].glyph)
        self.assertEquals(trans['points'], False)
コード例 #2
0
    def test_source(self):
        ar_downsample._loadAR()
        sess = Session(client=app.test_client())
        output_server('Census', session=sess)
        source = ServerDataSource(expr={
            'op': 'Field',
            'args': [':leaf', 'bivariate']
        })

        plot = figure()
        plot.square('A', 'B', source=source)

        agg = ar_downsample.CountCategories()
        info = ar_downsample.Const(val=1)
        shader = ar_downsample.InterpolateColor()

        new_source = ar_downsample.source(plot,
                                          agg=agg,
                                          info=info,
                                          shader=shader)
        self.assertIsNotNone(new_source.transform)
        trans = new_source.transform

        self.assertEquals(trans['resample'], 'abstract rendering')
        self.assertEquals(trans['agg'], agg)
        self.assertEquals(trans['info'], info)
        self.assertEquals(trans['shader'], shader)
        self.assertEquals(trans['glyphspec'],
                          plot.select({'type': GlyphRenderer})[0].glyph)
        self.assertEquals(trans['points'], False)
コード例 #3
0
ファイル: test_ar_downsample.py プロジェクト: dalejung/bokeh
    def test_source(self):
        ar_downsample._loadAR()
        source = ServerDataSource(data_url="fn://bivariate", owner_username="******")
        plot = square('A', 'B', source=source)

        agg = ar_downsample.CountCategories()
        info = ar_downsample.Const(val=1)
        shader = ar_downsample.InterpolateColor()

        new_source = ar_downsample.source(plot, agg=agg, info=info, shader=shader)
        self.assertIsNotNone(new_source.transform)
        trans = new_source.transform

        self.assertEquals(trans['resample'], 'abstract rendering')
        self.assertEquals(trans['agg'], agg)
        self.assertEquals(trans['info'], info)
        self.assertEquals(trans['shader'], shader)
        self.assertEquals(trans['glyphspec'], self._glyphspec(plot))
        self.assertEquals(trans['points'], False)
コード例 #4
0
ファイル: test_ar_downsample.py プロジェクト: richwu/bokeh
    def test_source(self):
        ar_downsample._loadAR()
        source = ServerDataSource(data_url="fn://bivariate", owner_username="******")
        plot = figure()
        plot.square('A', 'B', source=source)

        agg = ar_downsample.CountCategories()
        info = ar_downsample.Const(val=1)
        shader = ar_downsample.InterpolateColor()

        new_source = ar_downsample.source(plot, agg=agg, info=info, shader=shader)
        self.assertIsNotNone(new_source.transform)
        trans = new_source.transform

        self.assertEquals(trans['resample'], 'abstract rendering')
        self.assertEquals(trans['agg'], agg)
        self.assertEquals(trans['info'], info)
        self.assertEquals(trans['shader'], shader)
        self.assertEquals(trans['glyphspec'], self._glyphspec(plot))
        self.assertEquals(trans['points'], False)
コード例 #5
0
ファイル: census.py プロジェクト: ChrisBg/bokeh
import numpy as np
from bokeh.plotting import square, output_server, image, show
from bokeh.objects import ServerDataSource

import bokeh.transforms.ar_downsample as ar
#from bokeh.transforms import line_downsample


output_server("Census")
#2010 US Census tracts
source = ServerDataSource(data_url="/defaultuser/CensusTracts.hdf5", owner_username="******")
plot = square( 'LON','LAT',source=source)
heatmap = ar.source(plot, palette=["Reds-9"], points=True)
image(source=heatmap, title="Census Tracts", reserve_val=0, plot_width=600, plot_height=400, **ar.mapping(heatmap))

show()
コード例 #6
0
import numpy as np
from bokeh.plotting import square, output_server, image, show
from bokeh.objects import ServerDataSource

import bokeh.transforms.ar_downsample as ar
#from bokeh.transforms import line_downsample


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


# Simple heat-map: bin the counts ('tis the default configuration....)
heatmap =ar.source(plot, palette=["Reds-9"])
image(source=heatmap, title="Heatmap", reserve_val=0, **ar.mapping(heatmap))

#Perceptually corrected heat-map.  Cube-root then bin
percepmap = ar.source(plot, shader=ar.Cuberoot(), palette=["Reds-9"])
image(source=percepmap, title="Perceptually corrected", reserve_val=0, **ar.mapping(percepmap))


# 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.replot(plot, title="ISO Contours", shader=ar.Contour(levels=len(colors)), line_color=colors)

#"""
#In order to run the 'stocks' example, you have to execute
#./bokeh-server -D remotedata
#
#The remote data directory in the bokeh checkout has the sample data for this example
コード例 #7
0
ファイル: abstractrender.py プロジェクト: B-Rich/bokeh
#aggregator = ar.source(ar.count(), ar.const(1), ar.touches())  ### Aggregator is incomplete without shader and glyphs.  Can add either to it
#shader = ar.Cuberoot()+ar.Interpolate(0,9) + ar.Floor()
#image(source=plot+aggregator+shader, palette=["reds-9"])   ###Implement aggregator.__radd__ to get a plot and .__add__ to get a shader


"""
In order to run the 'stocks' 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
"""

#Stock-data plotting
#source = ServerDataSource(data_url="/defaultuser/AAPL.hdf5", owner_username="******")
#plot = square('volume','close',color='#FF00FF',source=source)
#percepmap = ar.source(plot, shader=ar.Cuberoot(), palette=["Reds-9"])
#image(source=percepmap, title="Perceptually corrected (Stocks)", reserve_val=0, **ar.mapping(percepmap))

#2010 US Census tracts
source = ServerDataSource(data_url="/defaultuser/CensusTracts.hdf5", owner_username="******")
plot = square( 'INTPTLONG','INTPTLAT',source=source)
heatmap = ar.source(plot, palette=["Reds-9"])
image(source=heatmap, title="Census Tracts", reserve_val=0, **ar.mapping(heatmap))

show()


コード例 #8
0
ファイル: abstractrender.py プロジェクト: asmeurer/bokeh
import numpy as np
from bokeh.plotting import square, output_server, image, show
from bokeh.objects import Range1d, ServerDataSource

import bokeh.transforms.ar_downsample as ar
#from bokeh.transforms import line_downsample


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


# Simple heat-map: bin the counts ('tis the default configuration....)
heatmap =ar.source(plot, palette=["Reds-9"])
image(source=heatmap, title="Heatmap", reserve_val=0, **ar.mapping(heatmap))
#image(source=heatmap, reserve_val=0, reserve_color=0xaaaaaa, **ar.mapping(heatmap))

###Perceptually corrected heat-map.  Cube-root then bin
percepmap = ar.source(plot, shader=ar.Cuberoot()+ar.Interpolate(low=0,high=9), palette=["Reds-9"])
image(source=percepmap, title="Perceptually corrected", reserve_val=0, **ar.mapping(percepmap))
#percepmap could technically be just ar.source(plot, shader=ar.Cuberoot(), palette=["Reds-9"]) but I'm testing shader sequences...


### Contours come in the same framework, but since the results of the shader are lines you use a different plotting function... 
#contour = ar.source(glyphs=plot, agg=ar.Count(), info=ar.Const(1), shader=ar.Contour(9))
#multi_line(source=countour, palette=["reds-9"])
#
#
##Alternative: aggregator as an incomplete resampler
#aggregator = ar.source(ar.count(), ar.const(1), ar.touches())  ### Aggregator is incomplete without shader and glyphs.  Can add either to it