Ejemplo n.º 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)
Ejemplo n.º 2
0
    def test_infos(self):
        configs = [(ar_downsample.AutoEncode(), infos.AutoEncode, {}),
                   (ar_downsample.Const(val=3), types.FunctionType, {}),
                   #(ar_downsample.Encode(cats=[10, 20, 30]), types.FunctionType, {}) TODO: Error in Python 3, restore in AR 0.6
                   ]

        for (proxy, target, kwargs) in configs:
            self._reify_tester(proxy, target, kwargs)
Ejemplo n.º 3
0
    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)
Ejemplo n.º 4
0
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")

# 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")


# # Multiple categories