diff --git a/plotgen.py b/plotgen.py index 16cc664..6125156 100755 --- a/plotgen.py +++ b/plotgen.py @@ -9,12 +9,12 @@ import math def circlepolygon(radius, center, resolution=20): points=[[center[0] + math.cos(((2*math.pi)/resolution)*i)*radius*1.15, center[1] + math.sin(((2*math.pi)/resolution)*i)*radius] for i in range(resolution)] return points -def genplot(diclist): +def genplot(diclist, resolution=150): for area in tqdm(diclist, ncols=50): for figure in area['zone']: if figure[0] == 'cercle' : xcoords,ycoords=[],[] - for xaxis,yaxis in circlepolygon(figure[1]/100000, figure[2::], resolution=100): + for xaxis,yaxis in circlepolygon(figure[1]/100000, figure[2::], resolution=resolution): xcoords.append(xaxis) ycoords.append(yaxis) xcoords.append(xcoords[0]) @@ -30,7 +30,7 @@ def genplot(diclist): xcoords.append(xcoords[0]) ycoords.append(ycoords[0]) plt.plot(xcoords,ycoords,'b') - plt.plot(xcoords,ycoords,'rs') + plt.plot(sum(xcoords)/len(xcoords),sum(ycoords)/len(ycoords),'rs') plt.fill(xcoords,ycoords,'g') return plt