def test_Quad(): glyph = Quad() assert glyph.left == "left" assert glyph.right == "right" assert glyph.bottom == "bottom" assert glyph.top == "top" yield check_fill, glyph yield check_line, glyph yield check_props, glyph, ["left", "right", "bottom", "top"], FILL, LINE
def pyramid_plot(self): from bokeh.objects import (Plot, DataRange1d, LinearAxis, Grid, Legend, SingleIntervalTicker) from bokeh.glyphs import Quad xdr = DataRange1d(sources=[ self.source_pyramid.columns("male"), self.source_pyramid.columns("female") ]) ydr = DataRange1d(sources=[self.source_pyramid.columns("groups")]) self.plot = Plot(title=None, x_range=xdr, y_range=ydr, plot_width=600, plot_height=600) xaxis = LinearAxis() self.plot.add_layout(xaxis, 'below') yaxis = LinearAxis(ticker=SingleIntervalTicker(interval=5)) self.plot.add_layout(yaxis, 'left') self.plot.add_layout(Grid(dimension=0, ticker=xaxis.ticker)) self.plot.add_layout(Grid(dimension=1, ticker=yaxis.ticker)) male_quad = Quad(left="male", right=0, bottom="groups", top="shifted", fill_color="#3B8686") male_quad_glyph = self.plot.add_glyph(self.source_pyramid, male_quad) female_quad = Quad(left=0, right="female", bottom="groups", top="shifted", fill_color="#CFF09E") female_quad_glyph = self.plot.add_glyph(self.source_pyramid, female_quad) self.plot.add_layout( Legend(legends=dict(Male=[male_quad_glyph], Female=[female_quad_glyph])))
def pyramid(): xdr = DataRange1d(sources=[ source_pyramid.columns("male"), source_pyramid.columns("female") ]) ydr = DataRange1d(sources=[source_pyramid.columns("groups")]) plot = Plot(title=None, x_range=xdr, y_range=ydr, plot_width=600, plot_height=600) xaxis = LinearAxis() plot.add_layout(xaxis, 'below') yaxis = LinearAxis(ticker=SingleIntervalTicker(interval=5)) plot.add_layout(yaxis, 'left') plot.add_layout(Grid(dimension=0, ticker=xaxis.ticker)) plot.add_layout(Grid(dimension=1, ticker=yaxis.ticker)) male_quad = Quad(left="male", right=0, bottom="groups", top="shifted", fill_color="#3B8686") male_quad_glyph = plot.add_glyph(source_pyramid, male_quad) female_quad = Quad(left=0, right="female", bottom="groups", top="shifted", fill_color="#CFF09E") female_quad_glyph = plot.add_glyph(source_pyramid, female_quad) plot.add_layout( Legend( legends=dict(Male=[male_quad_glyph], Female=[female_quad_glyph]))) return plot
def pyramid(): xdr = DataRange1d(sources=[source_pyramid.columns("male"), source_pyramid.columns("female")]) ydr = DataRange1d(sources=[source_pyramid.columns("groups")]) plot = Plot(title=None, data_sources=[source_pyramid], x_range=xdr, y_range=ydr, plot_width=600, plot_height=600) xaxis = LinearAxis(plot=plot, dimension=0) yaxis = LinearAxis(plot=plot, dimension=1, ticker=SingleIntervalTicker(interval=5)) xgrid = Grid(plot=plot, dimension=0, axis=xaxis) ygrid = Grid(plot=plot, dimension=1, axis=yaxis) male_quad = Quad(left="male", right=0, bottom="groups", top="shifted", fill_color="blue") male_quad_glyph = Glyph(data_source=source_pyramid, xdata_range=xdr, ydata_range=ydr, glyph=male_quad) plot.renderers.append(male_quad_glyph) female_quad = Quad(left=0, right="female", bottom="groups", top="shifted", fill_color="violet") female_quad_glyph = Glyph(data_source=source_pyramid, xdata_range=xdr, ydata_range=ydr, glyph=female_quad) plot.renderers.append(female_quad_glyph) legend = Legend(plot=plot, legends=dict(Male=[male_quad_glyph], Female=[female_quad_glyph])) plot.renderers.append(legend) return plot
line_color="#D95F02", line_width=2)), ("line", Line(x="x", y="y", line_color="#F46D43")), ("multi_line", MultiLine(xs="xs", ys="ys", line_color="#8073AC", line_width=2)), ("oval", Oval(x="x", y="y", width=screen(15), height=screen(25), angle=-0.7, fill_color="#1D91C0")), ("patch", Patch(x="x", y="y", fill_color="#A6CEE3")), ("patches", Patches(xs="xs", ys="ys", fill_color="#FB9A99")), ("quad", Quad(left="x", right="xm01", top="y", bottom="ym01", fill_color="#B3DE69")), ("quadratic", Quadratic(x0="x", y0="y", x1="xp02", y1="y", cx="xp01", cy="yp01", line_color="#4DAF4A", line_width=3)), ("ray", Ray(x="x", y="y", length=45, angle=-0.7, line_color="#FB8072",
def setUp(self): from bokeh.glyphs import Quad self.test_quad = Quad()