我正在使用Python 2.7.10和matplotlib 1.4.3
我正在尝试绘制一个包含
实例的图matplotlib.patches.Arc(xy, width, height, angle=0.0, theta1=0.0, theta2=360.0, **kwargs)
在运行期间,我允许用户更改影响绘图的某些参数。在这种情况下,我试图更改已存在的Arc实例的theta1和theta2参数。
但是,theta1和theta2参数不会更新。我能够更新其他参数:中心,宽度,高度和角度,但不能更新theta1和theta2。
我通过
实例化一个弧Arc1 = matplotlib.patches.Arc(....)
然后在子程序中,我用
更改了一些参数Arc1.center = new_center_position #Changes parameter
Arc1.width = new_width #Changes parameter
Arc1.height = new_height #Changes parameter
Arc1.angle = new_angle #Changes parameter
Arc1.theta1 = new_start_angle #Does not change parameter
Arc1.theta2 = new_end_angle #Does not change parameter
fig.canvas.draw_idle() #Redraw canvas to reflect changes
其次,是否有其他方法可以一次更新多个参数而无需在新行中执行每个参数?
答案 0 :(得分:0)
我个人认为这是一个错误,你可以在matplotlib上提出一个问题。
问题是,在设置
MessagingCenter.Subscribe((App)Xamarin.Forms.Application.Current, "Hi", (sender) => {
labelStatus.Text = "We have the Hi message here";
});
时,不会更新包含弧的Path
。由于matplotlib.patches.Arc.theta1
没有任何setter方法,因此解决方法是每次都通过
matplotlib.patches.Arc
Path
以下是如何使用它的完整示例。
matplotlib.patches.Arc._path = matplotlib.patches.Path.arc(theta1 , theta2)