コード例 #1
0
    def test_shaders(self):
        shaders = [
            (ar_downsample.BinarySegment(low=1, high=2, divider=10),
             numeric.BinarySegment, {}),
            (ar_downsample.Contour(), contour.Contour, {}),
            (ar_downsample.Cuberoot(), numeric.Cuberoot, {}),
            (ar_downsample.HDAlpha(), categories.HDAlpha, {}),
            (ar_downsample.Id(), general.Id, {}),
            (ar_downsample.Interpolate(low=0,
                                       high=10), numeric.Interpolate, {}),
            (ar_downsample.InterpolateColor(low=(10, 10, 10),
                                            high=(200, 200, 200),
                                            reserve=(0, 0, 0),
                                            empty=-1),
             numeric.InterpolateColors, {}),
            (ar_downsample.Log(), npg.Log10, {}),
            (ar_downsample.NonZeros(), categories.NonZeros, {}),
            (ar_downsample.Ratio(), categories.Ratio, {}),
            (ar_downsample.Seq(first=ar_downsample.Id(),
                               second=ar_downsample.Sqrt()), ar.Seq, {}),
            (ar_downsample.Spread(factor=2), npg.Spread, {}),
            (ar_downsample.Sqrt(), numeric.Sqrt, {}),
            (ar_downsample.ToCounts(), categories.ToCounts, {}),
        ]

        for (shader, target, kwargs) in shaders:
            self._shader_tester(shader, target, kwargs)
コード例 #2
0
ファイル: abstractrender.py プロジェクト: trayvou/bokeh
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
source = ServerDataSource()
コード例 #3
0
#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"