def draw(self, renderer):
     for coord, text in zip(self._verts3d, self.s):
         xs3d, ys3d, zs3d = coord[0], coord[1], coord[2]
         xs, ys, zs = proj_transform(xs3d, ys3d, zs3d, renderer.M)
         self.xy = (xs, ys)
         Annotation.set_text(self, text)
         Annotation.draw(self, renderer)
示例#2
0
def test_arrow_annotation_get_window_extent():
    figure = Figure(dpi=100)
    figure.set_figwidth(2.0)
    figure.set_figheight(2.0)
    renderer = RendererAgg(200, 200, 100)

    # Text annotation with arrow
    annotation = Annotation('',
                            xy=(0.0, 50.0),
                            xytext=(50.0, 50.0),
                            xycoords='figure pixels',
                            arrowprops={
                                'facecolor': 'black',
                                'width': 8,
                                'headwidth': 10,
                                'shrink': 0.0
                            })
    annotation.set_figure(figure)
    annotation.draw(renderer)

    bbox = annotation.get_window_extent()
    points = bbox.get_points()

    eq_(bbox.width, 50.0)
    assert_almost_equal(bbox.height, 10.0 / 0.72)
    eq_(points[0, 0], 0.0)
    eq_(points[0, 1], 50.0 - 5 / 0.72)
示例#3
0
 def draw(self, renderer):
     '''overload parent method'''
     
     xs3d, ys3d, zs3d = self._verts3d
     xs, ys, zs = proj_transform(xs3d, ys3d, zs3d, renderer.M)
     self.xy=(xs,ys)
     Annotation.draw(self, renderer)
示例#4
0
def test_empty_annotation_get_window_extent():
    figure = Figure(dpi=100)
    figure.set_figwidth(2.0)
    figure.set_figheight(2.0)
    renderer = RendererAgg(200, 200, 100)

    # Text annotation with arrow
    annotation = Annotation(
        '', xy=(0.0, 50.0), xytext=(0.0, 50.0), xycoords='figure pixels')
    annotation.set_figure(figure)
    annotation.draw(renderer)

    bbox = annotation.get_window_extent()
    points = bbox.get_points()

    eq_(points[0, 0], 0.0)
    eq_(points[1, 0], 0.0)
    eq_(points[1, 1], 50.0)
    eq_(points[0, 1], 50.0)
示例#5
0
def test_empty_annotation_get_window_extent():
    figure = Figure(dpi=100)
    figure.set_figwidth(2.0)
    figure.set_figheight(2.0)
    renderer = RendererAgg(200, 200, 100)

    # Text annotation with arrow
    annotation = Annotation(
        '', xy=(0.0, 50.0), xytext=(0.0, 50.0), xycoords='figure pixels')
    annotation.set_figure(figure)
    annotation.draw(renderer)

    bbox = annotation.get_window_extent()
    points = bbox.get_points()

    eq_(points[0, 0], 0.0)
    eq_(points[1, 0], 0.0)
    eq_(points[1, 1], 50.0)
    eq_(points[0, 1], 50.0)
示例#6
0
def test_arrow_annotation_get_window_extent():
    figure = Figure(dpi=100)
    figure.set_figwidth(2.0)
    figure.set_figheight(2.0)
    renderer = RendererAgg(200, 200, 100)

    # Text annotation with arrow
    annotation = Annotation(
        '', xy=(0.0, 50.0), xytext=(50.0, 50.0), xycoords='figure pixels',
        arrowprops={
            'facecolor': 'black', 'width': 8, 'headwidth': 10, 'shrink': 0.0})
    annotation.set_figure(figure)
    annotation.draw(renderer)

    bbox = annotation.get_window_extent()
    points = bbox.get_points()

    eq_(bbox.width, 50.0)
    assert_almost_equal(bbox.height, 10.0 / 0.72)
    eq_(points[0, 0], 0.0)
    eq_(points[0, 1], 50.0 - 5 / 0.72)
 def draw(self, renderer):
     xs3d, ys3d, zs3d = self._verts3d
     xs, ys, zs = proj_transform(xs3d, ys3d, zs3d, renderer.M)
     self.xy=(xs,ys)
     Annotation.draw(self, renderer)        
示例#8
0
 def draw(self, renderer):
     xs3d, ys3d, zs3d = self._verts3d
     xs, ys, zs = proj3d.proj_transform(xs3d, ys3d, zs3d, renderer.M)
     Annotation.set_position(self, (xs,ys))
     Annotation.draw(self, renderer)