Files
sf-op/script/test/MultiplePlot.py
2016-06-16 17:12:31 +02:00

39 lines
855 B
Python

import random
title = "test"
def add_plot(x,y, name=None):
global title
plots = get_plots(title = title)
if len(plots)==0:
p = plot(None,name=name, title = title)[0]
p.setLegendVisible(True)
else:
p = plots[0]
p.addSeries(LinePlotSeries(name))
s = p.getSeries(name)
s.setData(x, y)
x1,x2,y1,y2 = min(x), max(x), min(y), max(y)
bb = p.addSeries(LinePlotSeries(name + " BBox"))
bb=p.getSeries(name + " BBox")
bb.setColor(s.getColor)
bb.setData([x1,x2, x2, x1, x1], [y1, y1, y2, y2, x1])
x=[]
y=[]
for step in range(1,10):
x=[]
y=[]
for i in range(20):
x.append(random.random() * 100 / step)
y.append(random.random() * 100/ step)
add_plot (x,y,"Step " + str(step))