1
지도 중 하나를 클릭하면 두 점을 연결하는 콜백 함수가 설정되어 있습니다. 내 문제는 그들을 연결하는 줄을 삭제할 수없는 것입니다. 기본적으로 아래 함수는 마커를 클릭 할 때마다 호출됩니다. 오래된 거대한 원을 삭제하고 새 원을 그려야합니다. 대신, 이전 행을 삭제하는 대신 새로운 행을 계속 작성합니다. if 문은 예상대로 작동하기 때문에 무시할 수 있습니다. 생각?Python Basemap 큰 원을 제거하십시오.
def mapPair(self,localLat,localLon,remoteLat, remoteLon):
if self.connectingLine != None:
self.connectingLine.remove() # <--doesn't work
if localLat != "unknown" and self.currentLocalItem is None:
self.currentLocalItem, = self.map.plot(localLon, localLat, 'bo', markersize=15, color='g', label="Local")
elif localLat!= "unknown" and self.currentLocalItem is not None:
self.currentLocalItem.set_ydata(localLat)
self.currentLocalItem.set_xdata(localLon)
self.connectingLine = self.map.drawgreatcircle(localLon, localLat, remoteLon, remoteLat, lw=3)
self.fig.canvas.draw()
난 그냥 다시 가서 같은 self.connectingLine.get_xydata 같은 더 많은 기능을 실행하려고 주위에 있었고, 난이 오류 "인쇄 self.connectingLine를 얻을. get_xydata() AttributeError : 'list'객체에 'get_xydata'속성이 없습니다. ".... 무슨 일이 벌어지고 있는지 전혀 모르겠습니다. apprently someself self.connectingLine은 객체 대신 목록입니까? –