我有定义桥梁开口形状的数据。我已经开发了代码,用一条水平线切开桥的开口,就好像它是水位一样,包括桥墩和墙壁上的交点。我想确保形状始终是边界形状,而不是被切成对角线。当我使用“排序”并绘制数据时,我得到一个Zig Zaw Shape ...所以从另一个过程中获得的Co-ords序列是A,我需要的序列是B ...?如何确保左侧和右侧的垂直点是避免Zig Zaw的序列?
def Plot_Poly(Poly):
"""
PLOTS THE DATA From the XS Files
"""
import matplotlib.pyplot as plt
#============ PLOT ROUTINE FOR CROSS SECTIONS ==============
print 'About to Plot'
plt.clf() # Clear any Previous Plots...
plt.ylabel('Station Elevation (mAHD)')
plt.xlabel('Station Distance (m)')
plt.plot([row[0] for row in Poly],[row[1] for row in Poly],marker='o',linestyle='--',dashes=(5,10)) # Plot the Time Series
plt.show()
return()
A = [[0,0.95],[0,0],[1,0.95],[1,0.0],[2,0.95],[2,0],[3,0.95],[3,0.0],[4.0,0.95],[4,0],[5,0.95],[5,0.0]]
Plot_Poly(A)
B = [[0,0.95],[0,0],[1,0],[1,0.95],[2,0.95],[2,0],[3,0],[3,0.95],[4.0,0.95],[4,0],[5,0],[5,0.95]]
Plot_Poly(B)