import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline
from ipywidgets import StaticInteract, RangeWidget
def plot(b,r):
fig, ax = plt.subplots(figsize=(4, 3),
subplot_kw={'axisbg':'#EEEEEE',
'axisbelow':True})
ax.grid(color='w', linewidth=2, linestyle='solid')
x = np.linspace(0,10,501)
ax.plot(x,np.exp(-(x-5)**2/(2*b**2)), lw=5, alpha=0.4)
U = np.arange(0,10,r)
ax.quiver(U,100)
return fig
StaticInteract(plot,b=RangeWidget(1, 3, 1),r=RangeWidget(0.5, 2.5, 0.5))
def plot(b,r):
fig, ax = plt.subplots(figsize=(4, 3),
subplot_kw={'axisbg':'#EEEEEE',
'axisbelow':True})
ax.grid(color='w', linewidth=2, linestyle='solid')
x = np.linspace(0,10,501)
ax.plot(x,np.exp(-(x-5)**2/(2*b**2)), lw=5, alpha=0.4)
U = np.arange(0,10,r)
ax.quiver(U,100)
return fig
StaticInteract(plot,b=RangeWidget(1, 3, 1),r=RangeWidget(0.5, 2.5, 0.5))
def plot(r):
fig, ax = plt.subplots(figsize=(4, 3),
subplot_kw={'axisbg':'#EEEEEE',
'axisbelow':True})
ax.grid(color='w', linewidth=2, linestyle='solid')
U = np.arange(0,10,r)
ax.quiver(U,100)
#ax.set_xlim(-50, 50)
#ax.set_ylim(0, 1)
return fig
StaticInteract(plot,r=RangeWidget(0.5, 2.5, 0.5))