October 2018
Beginner to intermediate
676 pages
18h 30m
English
The following are the steps to implement the TextBox widget:
fig, ax = plt.subplots()plt.subplots_adjust(bottom=0.2)
x = np.arange(-5.0, 5.0, 0.01)y = x ** 5
l, = plt.plot(x, y, lw=2)
def submit(text): ydata = eval(text) l.set_ydata(ydata) ax.set_ylim(np.min(ydata), np.max(ydata)) plt.draw()
axbox = plt.axes([0.1, 0.05, 0.8, 0.075])initial_text = "x ** 5"
text_box = TextBox(axbox, ...
Read now
Unlock full access