Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import numpy as np
- import matplotlib.pyplot as pl
- import pdb
- def plotData(data, options='', limits=[]):
- group_colors = []
- for i,dset in enumerate(data):
- x = np.array([point['x'] for point in dset])
- y = np.array([-point['y'] for point in dset])
- if options != '':
- pl.plot(x,y,options)
- else:
- pl.plot(x,y)
- pl.hold(True)
- pl.annotate(str(i), xy = (x[0],y[0]))
- if len(limits):
- pl.gca().set_xlim(limits[0],limits[1])
- pl.gca().set_ylim(limits[2],limits[3])
- def testPlot():
- colors = ['b','g','r','c','m','k','y']
- data1 = [[dict(x=1,y=1),dict(x=2,y=2),dict(x=3,y=3)],[dict(x=2,y=2),dict(x=4,y=4)],[dict(x=5,y=5),dict(x=6,y=8)]]
- data2 = [[dict(x=1,y=1),dict(x=2,y=2),dict(x=3,y=3)],[dict(x=2,y=2),dict(x=4,y=4)]]
- data = []
- data.append(data1)
- data.append(data2)
- data.append(data1)
- pl.figure()
- pl.ion()
- pl.subplot(2,1,1)
- # Title with best definition from dictionary
- pl.title("Title on top")
- # Plot the data but colored according to segmentation in top plot
- for i in range(len(data1)):
- plotData([data1[i]],colors[i%len(colors)])
- # Then plot segmentation parts (radicals) in different corresponding colors
- # Title each plot with radical names
- for i in range(len(data)):
- pl.subplot(2,3,4+i)
- pl.title("Row 2 subplot {0}".format(i))
- plotData(data[i],colors[i%len(colors)],[0, 15, 0, 15])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement