-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexample.py
executable file
·33 lines (32 loc) · 908 Bytes
/
example.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/usr/bin/python
import glob
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.widgets import Slider, Button, RadioButtons
fig=plt.figure(1)
ax=plt.axes([0.1,0.2,0.55,0.8])
#ax2=plt.axes([0.15,0.25,0.25,0.35])
def Chi(omega,tau_c):
return omega*tau_c/(1.+omega**2 * tau_c **2)
def update(val):
l1=10.0**val
print val
print ax.lines.pop(0)
plt.plot(omega,Chi(omega,l1))
# for brlxs in brlx: brlxs+l1
plt.draw()
def reset(event):
stau_c.reset()
axcolor = 'lightgoldenrodyellow'
axtau_c=plt.axes([0.425,0.1,0.3,0.02],axisbg=axcolor)
stau_c=Slider(axtau_c,'log (tau_c)',-9,9,valinit=np.log10(10))
stau_c.on_changed(update)
resetax=plt.axes([0.9,0.001,0.1,0.02])
button = Button(resetax,'reset',color=axcolor,hovercolor='.975')
button.on_clicked(reset)
plt.axes([0.1,0.2,0.55,0.8])
plt.xscale('log')
plt.yscale('log')
omega=np.logspace(2,8,15,5)
plt.plot(omega,Chi(omega,2))
plt.show()