I created a polar in python matplotlib.now I want to change the line I draw using the function 'plot()' in the same polar. how to do it? thanks very much!
following is my code
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')
but I don't know why it worked. first I try to code this:
t = self.axes_az.plot(theta, r, 'r)
t.set_xdata(theta1) #theta1 is different from theta
but it can't work,the error is
list don't have attribute 'set_xdata'
then I changed to this:
t, = self.axes_az.plot(theta, r, 'r')
t.set_xdata(theta1)
and it worked. why it worked after I added a ',' ? thanks!