updating changed diagram?

Hi,

I want to change the value of a line in an axes. What I tried is

myline = axes.plot(...)

xdata, ydata = myline.get_data()
for i in range(ydata.__len__()):
  ydata[i] += 50

to shift all y values up by 50.

But I dont see the change I made, even after a show(). How can I force
the diagram to show the changed value?

Regards

Ole

Hi Ole,

you can reset the ydata using:
ydata = myline.get_ydata()
ydata += 50
myline.set_ydata(ydata) # pass new data to line object

or just in-place
myline.set_ydata( myline.get_ydata() + 50)

after that you need a draw to redraw the figure or a show to show up the
result.

Does this work for you?

best regards
Matthias

···

On Wednesday 10 June 2009 12:29:11 Ole Streicher wrote:

Hi,

I want to change the value of a line in an axes. What I tried is

myline = axes.plot(...)

xdata, ydata = myline.get_data()
for i in range(ydata.__len__()):
  ydata[i] += 50

to shift all y values up by 50.

But I dont see the change I made, even after a show(). How can I force
the diagram to show the changed value?

Regards

Ole