Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/336.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何更改python中使用的matplotlib中相同极坐标的行_Python_Matplotlib - Fatal编程技术网

如何更改python中使用的matplotlib中相同极坐标的行

如何更改python中使用的matplotlib中相同极坐标的行,python,matplotlib,Python,Matplotlib,我在python matplotlib中创建了一个极轴。现在我想在同一个极轴中使用函数“plot()”来更改绘制的直线。怎么做?非常感谢 下面是我的代码 figure_az = matplotlib.figure.Figure() self.canvas_az = FigureCanvas(sbSizer3.GetStaticBox(), -1, figure_az) self.axes_az = figure_az.add_subplot(111, polar=True) self.axes_

我在python matplotlib中创建了一个极轴。现在我想在同一个极轴中使用函数“plot()”来更改绘制的直线。怎么做?非常感谢

下面是我的代码

figure_az = matplotlib.figure.Figure()
self.canvas_az = FigureCanvas(sbSizer3.GetStaticBox(), -1, figure_az)
self.axes_az = figure_az.add_subplot(111, polar=True)
self.axes_az.set_theta_zero_location('N')
figure_az.set_facecolor('#F0F0F0')
self.axes_az.grid(color='#888888')
self.axes_az.set_theta_direction(-1)

self.axes_az.set_xticklabels(['0', '45', '90', '145', '180', '-145', '-90', '-45'], color='#111111', fontsize=10)
self.axes_az.set_axis_bgcolor('#111111')
self.axes_az.set_rticks([])
self.axes_az.set_rlabel_position(120)

r = np.arange(0, 2, 0.01)
theta = [0] * len(r)
self.axes_az.plot(theta, r, 'r')
但我不知道为什么它会起作用。 首先,我尝试编写以下代码:

t = self.axes_az.plot(theta, r, 'r)
t.set_xdata(theta1) #theta1 is different from theta
但它不能工作,错误是

list don't have attribute 'set_xdata'
然后我改成这样:

t, = self.axes_az.plot(theta, r, 'r')
t.set_xdata(theta1)
它成功了。为什么在我添加了一个“,”之后它会起作用?
谢谢

不清楚你在问什么。代码中已经有线条图;如果你想改变它,是什么阻碍了你?问题在哪里?@ImportanceOfBeingErnest我已经解决了这个问题。同时感谢可能的副本: