중요한 비트를 요약하면 다음과 같습니다.Circle Patch의 set_radius에 해당하는 타원 패치? Matplotlib
저는 matplotlib 그래프에 원을 그려주는 함수가 있습니다. 매번 함수를 기억할 때마다 그래프의 같은 위치에 항상 있어야하기 때문에 (set_radius를 사용하여) 원의 크기를 간단히 조정합니다. 이렇게하면 엉망이되지 않습니다.
타원형 패치로 같은 것을하고 싶지만 이번에는 높이, 너비 및 각도를 변경할 수 있습니다. 내 코드는 좀 더 설명 드리겠습니다 문맥 조금 있으면 그러나 나는 set_radius
def Moment_Of_Inertia(self):
"""Plot the moment of Inertia ellipse, with the ratio factor """
# my code to get ellipse/circle properties
self.limitradius = findSBradius(self.RawImage,self.SBLimit)[0]
MoIcall = mOinertia(self.RawImage,self.limitradius)
self.ratio=MoIcall[0] # get the axes ratio
self.height=1
Eigenvector = MoIcall[1]
self.EllipseAngle np.degrees(np.arctanh((Eigenvector[1]/Eigenvector[0])))
# This is the part I am not sure how to do
self.MoIellipse.set(width=self.ratio*15)
self.MoIellipse.set(height=self.height*15)
self.MoIellipse.set(angle= self.EllipseAngle)
# It works with a circle patch
self.circleLimit.set_radius(self.limitradius)
self.circleLimit.set_visible(True)
self.MoIellipse.set_visible(True)
self.canvas.draw()
의 동등한를 찾을 수없는, 내가 Tkinter의 창에서하기 matplotlib 그래프를 포함하는 것을 시도하고있다. 두 패치는 이미 생성자에서 초기화되어 있으며 크기를 조정하려고합니다.
무엇 '.MoIellipse'입니까? 읽고 [mcve]를 이해하십시오. – ImportanceOfBeingErnest
이것은 생성자에서 이미 초기화 한 패치의 이름입니다. – Speddy