N = 9 x = np.linspace(-2, 2, N) y = x**2 r = x / 15.0 + 0.3 source = ColumnDataSource(dict(x=x, y=y, r=r)) plot = Plot(title=None, width=300, height=300, min_border=0, toolbar_location=None) glyph = Wedge(x="x", y="y", radius="r", start_angle=0.6, end_angle=4.1, fill_color="#b3de69") 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)
angles = selected.Share.map(radians).cumsum() end_angles = angles.tolist() start_angles = [0] + end_angles[:-1] browsers_source = ColumnDataSource( dict( start=start_angles, end=end_angles, colors=[colors[browser] for browser in browsers], )) glyph = Wedge(x=0, y=0, radius=1, line_color="white", line_width=2, start_angle="start", end_angle="end", fill_color="colors") plot.add_glyph(browsers_source, glyph) def polar_to_cartesian(r, start_angles, end_angles): cartesian = lambda r, alpha: (r * cos(alpha), r * sin(alpha)) points = [] for start, end in zip(start_angles, end_angles): points.append(cartesian(r, (end + start) / 2)) return zip(*points)
width=screen(10), height=screen(20), angle=-0.7, fill_color="#CAB2D6")), ("segment", Segment(x0="x", y0="y", x1="xm01", y1="ym01", line_color="#F4A582", line_width=3)), ("text", Text(x="x", y="y", text=["hello"])), ("wedge", Wedge(x="x", y="y", radius=screen(15), start_angle=0.6, end_angle=4.1, fill_color="#B3DE69")), ] markers = [ ("circle", Circle(x="x", y="y", radius=0.1, fill_color="#3288BD")), ("circle_x", CircleX(x="x", y="y", size="sizes", line_color="#DD1C77", fill_color=None)), ("circle_cross", CircleCross(x="x", y="y", size="sizes", line_color="#FB8072", fill_color=None,