Hall?chen! John Hunter <jdhunter@...4...>
> writes:
>>>>>>> "Torsten" == Torsten Bronger
>>>>>>> <bronger@...669...> writes:
>>
> 2. The above loop is the last part of my program. The
> program terminates with
>>
> Fatal Python error: PyEval_RestoreThread: NULL tstate
>>
> Apparently, this is done by my improper handling of
> matplotlib. What's going wrong?
>> This is an annoyance we haven't been able to get rid of in all
>> use cases. animation using pylab and tkagg is one of the
>> places. I assume you are using the tkagg backend?
> Yes.
>> If you search the mailing list archives for
>> PyEval_RestoreThread, you'll see this in many contexts. For
>> any semi-serious animation work, I suggest you not use the
>> matplotlib/interactive mode shown in anim.py but rather use
>> your GUI's idle handling or timer mechanism as in
>> examples/anim_tk.py or examples/dyamic_image_gtkagg.py.
> Thanks, I'll do.
>> [...]
>>
> 3. How can I achieve that dynamic autoscaling of the
> y-axis? As noted in the source, "gcf().autoscale_view"
> has no effect.
>> This is not legal matplotlib code -- I assume you mean
>> gca().autoscale_view().
> Yes, sorry.
>> In the absence of more information it is hard top diagnose what
>> the problem is.
> Here is a complete example:
OK, that helps. The update of the data limits happens when you call
plot and friends (technically plot calls ax.add_line which calls
ax.update_datalim_numerix) . If you manually set the xdata or ydata
on the line object, you need to manually update the Axes datalim with
ax = gca()
for i in range(2*cycles):
voltages = number_of_values * [i % 2 + 3]
y_values[i * number_of_values : (i+1) * number_of_values] = \
voltages
line.set_ydata(y_values)
ax.update_datalim_numerix(x_values, y_values)
ax.autoscale_view()
draw()
time.sleep(1)
JDH