comparison python/utils.py @ 940:d8ab183a7351

verified motion prediction with prototypes at constant speed (test needed)
author Nicolas Saunier <nicolas.saunier@polymtl.ca>
date Tue, 18 Jul 2017 13:46:17 -0400
parents c7e72d758049
children 5d788d2e8ffc
comparison
equal deleted inserted replaced
939:a2f3f3ca241e 940:d8ab183a7351
834 834
835 ######################### 835 #########################
836 # plotting section 836 # plotting section
837 ######################### 837 #########################
838 838
839 def plotPolygon(poly, options = ''): 839 def plotPolygon(poly, options = '', **kwargs):
840 'Plots shapely polygon poly' 840 'Plots shapely polygon poly'
841 from numpy.core.multiarray import array
842 from matplotlib.pyplot import plot 841 from matplotlib.pyplot import plot
843 from shapely.geometry import Polygon 842 x,y = poly.exterior.xy
844 843 plot(x, y, options, **kwargs)
845 tmp = array(poly.exterior)
846 plot(tmp[:,0], tmp[:,1], options)
847 844
848 def stepPlot(X, firstX, lastX, initialCount = 0, increment = 1): 845 def stepPlot(X, firstX, lastX, initialCount = 0, increment = 1):
849 '''for each value in X, increment by increment the initial count 846 '''for each value in X, increment by increment the initial count
850 returns the lists that can be plotted 847 returns the lists that can be plotted
851 to obtain a step plot increasing by one for each value in x, from first to last value 848 to obtain a step plot increasing by one for each value in x, from first to last value