Exemplo n.º 1
0
def hgm_family_circle_image(AB):
    A,B = AB.split("_")
    from plot import circle_image
    A = map(int,A[1:].split("."))
    B = map(int,B[1:].split("."))
    G = circle_image(A, B)
    return image_callback(G)
Exemplo n.º 2
0
def hgm_family_circle_image(AB):
    A, B = AB.split("_")
    from plot import circle_image
    A = map(int, A[1:].split("."))
    B = map(int, B[1:].split("."))
    G = circle_image(A, B)
    return image_callback(G)
Exemplo n.º 3
0
def hgm_family_circle_plot_data(AB):
    A, B = AB.split("_")
    from plot import circle_image
    A = map(int, A[1:].split("."))
    B = map(int, B[1:].split("."))
    G = circle_image(A, B)
    P = G.plot()
    import tempfile, os
    _, filename = tempfile.mkstemp('.png')
    P.save(filename)
    data = open(filename).read()
    os.unlink(filename)
    return data
Exemplo n.º 4
0
    def plot(self, typ="circle"):
        assert typ in ['circle', 'linear', 'constant']
        if typ == 'circle':
            G = circle_image(self.A, self.B)
        elif typ == 'linear':
            G = piecewise_linear_image(self.A, self.B)
        else:
            G = piecewise_constant_image(self.A, self.B)

        return encode_plot(G.plot(),
                           pad=0,
                           pad_inches=0,
                           bbox_inches='tight',
                           remove_axes=True)