示例#1
0
def main():
    # Create a random multiseries
    num_points = 10

    series_set = SeriesSet()
    for i in range(6):
        series_set.add_series(
            Series(
                "Series%s" % i,
                randomvalues(num_points),
                "#3366%2xff" % (50 * i),
                {
                    0: (i - 1) % 5,
                    5: 0
                },
            ))

    # Create the output
    output = FileOutput()

    # We'll have major lines every integer, and minor ones every half
    scale = SimpleScale(0, num_points - 1, 1)

    # OK, render that.
    wg = WaveGraph(series_set, scale, None, False)
    lb = Label("Test Graph", None)

    output.add_item(lb, x=10, y=5, width=490, height=20)
    output.add_item(wg, x=0, y=30, width=500, height=200)

    # Save the images
    output.write("svg", "random_wavegraph.svg")
    output.write("png", "random_wavegraph.png")
    output.write("pdf", "random_wavegraph.pdf")
示例#2
0
def main():
    # Create the NodeSet, and add some nodes to it
    nodeset = NodeSet()

    n = 30

    for i in range(n):
        node = Node(random.choice(list(range(10))))
        nodeset.add_node(node)

    # Add some test links
    for i in range(20):
        nodeset.add_link(
            NodeLink(random.choice(nodeset.nodes),
                     random.choice(nodeset.nodes)))

    # Make a scale
    value_min, value_max, value_range = nodeset.value_range()
    scale = SimpleScale(value_min, value_max, 1, 1)

    # Create the output
    output = FileOutput(style)

    # OK, render that.
    forcerel = ForceRelPlot(nodeset, style, scale)

    output.add_item(forcerel, x=0, y=0, width=200, height=600)

    # Save the images
    #output.write("svg", "forcerel.svg")
    #output.write("png", "forcerel.png")
    output.write("pdf", "forcerel.pdf")
示例#3
0
nodeset = NodeSet()

n = 30

for i in range(n):
    node = Node(random.choice(range(10)))
    nodeset.add_node(node)

# Add some test links
for i in range(20):
    nodeset.add_link(
        NodeLink(random.choice(nodeset.nodes), random.choice(nodeset.nodes)))

# Make a scale
value_min, value_max, value_range = nodeset.value_range()
scale = SimpleScale(value_min, value_max, 1, 1)

# Initialise our Style
css.install_hook()
import graphication.default_css as style

# Create the output
output = FileOutput(style)

# OK, render that.
forcerel = ForceRelPlot(nodeset, style, scale)

output.add_item(forcerel, x=0, y=0, width=200, height=600)

# Save the images
#output.write("svg", "forcerel.svg")
示例#4
0
series_set = SeriesSet()
for i in range(6):
    series_set.add_series(
        Series(
            "Series%s" % i,
            randomvalues(num_points),
            "#3366%2xff" % (50 * i),
            {
                0: (i - 1) % 5,
                5: 0
            },
        ))

# Create the output
output = FileOutput()

# We'll have major lines every integer, and minor ones every half
scale = SimpleScale(0, num_points - 1, 1)

# OK, render that.
wg = WaveGraph(series_set, scale, None, False)
lb = Label("Test Graph", None)

output.add_item(lb, x=10, y=5, width=490, height=20)
output.add_item(wg, x=0, y=30, width=500, height=200)

# Save the images
output.write("svg", "test.svg")
output.write("png", "test.png")
output.write("pdf", "test.pdf")