On 01/17/2011 10:24 PM, sprobst wrote:
>
> Hi all,
>
> I want to make a contout plot with a slider element. But I am not sure if it
> is possible at all and if it is possible how.

With contouring, you have to simply remake the ContourSet (that is, 
re-run contour) with any change to the data being contoured.

Eric

>
> The code is a mixture of two examples I found in the web. One part is the
> slider example of matplotlib
>
>
>
>> from pylab import *
>>
>> N = 50
>> x = linspace(.0, 1.0, N)
>> y = linspace(.0, 1.0, N)
>> X, Y = meshgrid(x, y)
>> Z = sin(X+16) - 2*cos(Y*5.2)
>> c = contourf(X, Y, Z,20)
>> colorbar()
>>
>> # Copied from the slider example ... not sure about the syntax
>> axfreq = axes([0.25, 0.1, 0.65, 0.03])
>> sfreq = Slider(axfreq, 'Amp', 0.1, 10.0, valinit=1)
>> def update(val):
>>      global sfreq
>>      freq = sfreq.val
>>      Z = sin(freq*X+16) - 2*cos(Y*5.2)
>>      c.set_data(Z) # Is something like that possible
>>      draw()
>> sfreq.on_changed(update)
>> show()
>>
>
> I tried different stuff, but could not solve the problem. Perhaps anybody
> has an idea to help me.
>
> Thank you!
>
>            Best regards
>               Stefan


------------------------------------------------------------------------------
Protect Your Site and Customers from Malware Attacks
Learn about various malware tactics and how to avoid them. Understand 
malware threats, the impact they can have on your business, and how you 
can protect your company and customers by using code signing.
http://p.sf.net/sfu/oracle-sfdevnl
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to