import numpy as np from bokeh.io import curdoc, show from bokeh.models import Annulus, ColumnDataSource, Grid, LinearAxis, Plot N = 9 x = np.linspace(-2, 2, N) y = x**2 source = ColumnDataSource(dict(x=x, y=y)) plot = Plot( title=None, width=300, height=300, min_border=0, toolbar_location=None) glyph = Annulus(x="x", y="y", inner_radius=.2, outer_radius=.4, fill_color="#7fc97f") plot.add_glyph(source, glyph) xaxis = LinearAxis() plot.add_layout(xaxis, 'below') yaxis = LinearAxis() plot.add_layout(yaxis, 'left') plot.add_layout(Grid(dimension=0, ticker=xaxis.ticker)) plot.add_layout(Grid(dimension=1, ticker=yaxis.ticker)) curdoc().add_root(plot) show(plot)
plot.title.align = "right" plot.api_key = "AIzaSyAX0RhQ5JTdQAjveEADHzBXbxkVLYCiPps" #color_mapper = CategoricalColorMapper(factors=['hi', 'lo'], palette=[RdBu3[2], RdBu3[0]]) #color_mapper = LogColorMapper(palette="Viridis5", low=min_median_house_value, high=max_median_house_value) paletteinvert = palette[::-1] color_mapper = CategoricalColorMapper(palette=["magenta", "cyan"], factors=['No', 'Yes']) color_mapper2 = LogColorMapper(palette=fire) protectedannulus = Annulus(x="lon", y="lat", inner_radius=4000, outer_radius=7000, fill_color="cyan", fill_alpha=0.3, line_color=None) unprotectedannulus = Annulus(x="lon", y="lat", inner_radius=4000, outer_radius=7000, fill_color={ 'field': 'color', 'transform': color_mapper }, fill_alpha=0.3, line_color=None)
return dict(value=value, units="screen") glyphs = [ ("annular_wedge", AnnularWedge(x="x", y="y", inner_radius=screen(10), outer_radius=screen(20), start_angle=0.6, end_angle=4.1, fill_color="#8888ee")), ("annulus", Annulus(x="x", y="y", inner_radius=screen(10), outer_radius=screen(20), fill_color="#7FC97F")), ("arc", Arc(x="x", y="y", radius=screen(20), start_angle=0.6, end_angle=4.1, line_color="#BEAED4", line_width=3)), ("bezier", Bezier(x0="x", y0="y", x1="xp02", y1="y",