Beispiel #1
0
    def test_PolyLine(self):
        source = _SourceShim(ar_downsample.Contour)
        result = ar_downsample.mapping(source)
        expected = {}

        self.assertEquals(len(expected), len(result))
        self.assertEquals(sorted(expected.keys()), sorted(result.keys()))

        source = _SourceShim(ar_downsample.Contour, "A", "B", "C")
        result = ar_downsample.mapping(source)
        expected['A'] = source.defVal
        expected['B'] = source.defVal
        expected['C'] = source.defVal
        self.assertEquals(sorted(expected.keys()), sorted(result.keys()))
Beispiel #2
0
    def test_PolyLine(self):
        source = _SourceShim(ar_downsample.Contour)
        result = ar_downsample.mapping(source)
        expected = {'line_color': []}

        self.assertEquals(len(expected), len(result))
        self.assertEquals(sorted(expected.keys()), sorted(result.keys()))

        source = _SourceShim(ar_downsample.Contour, "A", "B", "C")
        result = ar_downsample.mapping(source)
        expected['A'] = source.defVal
        expected['B'] = source.defVal
        expected['C'] = source.defVal
        self.assertEquals(sorted(expected.keys()), sorted(result.keys()))
Beispiel #3
0
    def test_ImageRGB(self):
        source = _SourceShim(ar_downsample.InterpolateColor)
        result = ar_downsample.mapping(source)
        expected = {'x_range': Range1d(start=0, end=0),
                    'y_range': Range1d(start=0, end=0)}

        self.assertEquals(len(expected), len(result))
        self.assertEquals(sorted(expected.keys()), sorted(result.keys()))

        source = _SourceShim(ar_downsample.InterpolateColor, "A", "B", "C")
        result = ar_downsample.mapping(source)
        expected['A'] = source.defVal
        expected['B'] = source.defVal
        expected['C'] = source.defVal
        self.assertEquals(sorted(expected.keys()), sorted(result.keys()))
Beispiel #4
0
    def test_ImageRGB(self):
        source = _SourceShim(ar_downsample.InterpolateColor)
        result = ar_downsample.mapping(source)
        expected = {'x_range': Range1d(start=0, end=0),
                    'y_range': Range1d(start=0, end=0)}

        self.assertEquals(len(expected), len(result))
        self.assertEquals(sorted(expected.keys()), sorted(result.keys()))

        source = _SourceShim(ar_downsample.InterpolateColor, "A", "B", "C")
        result = ar_downsample.mapping(source)
        expected['A'] = source.defVal
        expected['B'] = source.defVal
        expected['C'] = source.defVal
        self.assertEquals(sorted(expected.keys()), sorted(result.keys()))
Beispiel #5
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("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()
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
Beispiel #7
0
#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()