Exemplo n.º 1
0
    def test_contour_recipe(self):
        source = ServerDataSource(data_url="fn://bivariate", owner_username="******")
        plot = figure(plot_width=600,
                      plot_height=400,
                      title="Test Title")
        plot.square('A', 'B', source=source)

        plot2 = ar_downsample.contours(plot, title="Contour")
        source2 = self._find_source(plot2)

        self.assertEquals("Contour", 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, "multi_line")
Exemplo n.º 2
0
    def test_contour_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.contours(plot, title="Contour")
        source2 = self._find_source(plot2)

        self.assertEquals("Contour", 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, "multi_line")
Exemplo n.º 3
0
    def test_contour_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.contours(plot, title="Contour")
        source2 = self._find_source(plot2)

        self.assertEquals("Contour", 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, "multi_line")
Exemplo n.º 4
0
    def test_contour_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.contours(plot, title="Contour")
        source2 = self._find_source(plot2)

        self.assertEquals("Contour", 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, "multi_line")
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()
source.from_blaze(d.gauss, local=True)

plot = figure()
plot.square("oneA", "oneB", color="cats", source=source)
arplot = ar.hdalpha(plot, spread=5, title="Multiple categories")
show(plot)
Exemplo n.º 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()
Exemplo n.º 7
0
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")

# Multiple categories
source = ServerDataSource(data_url="fn://gauss", owner_username="******")
plot2 = square('oneA', 'oneB', color='cats', source=source)
ar.hdalpha(plot2, spread=5, title="Multiple categories")

show()
Exemplo n.º 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()