Example #1
0
def test_Wedge():
    glyph = Wedge()
    assert glyph.x == "x"
    assert glyph.y == "y"
    assert glyph.radius == None
    assert glyph.start_angle == "start_angle"
    assert glyph.end_angle == "end_angle"
    assert glyph.direction == "clock"
    yield check_fill, glyph
    yield check_line, glyph
    yield check_props, glyph, [
        "x", "y", "radius", "start_angle", "end_angle", "direction"
    ], FILL, LINE
Example #2
0
 def setUp(self):
     from bokeh.glyphs import Wedge
     self.test_wedge = Wedge()
Example #3
0
          y="y",
          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)),
    ("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,
            radius_units="data",
            fill_color="#3288BD")),
    ("circle_x",
     CircleX(x="x", y="y", size="sizes", line_color="#DD1C77",
             fill_color=None)),
    ("circle_cross",
Example #4
0
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)