python - Matplotlib checkbox (previous and next) -
i've created multiple figures don't want appear @ once, how use buttons or checkbox?
when click in next, change other figure
my code, show 2 figures, , dont this:
import matplotlib.pyplot plt intervals = ['52, 57', '57, 62', '62, 67', '67, 72', '72, 77', '77, 82', '82, 87'] absolute = [3, 11, 23, 27, 10, 5, 1] pos = np.arange(len(absolute)) # figure bars fi width = 1.0 fig1= plt.figure() ax1 = plt.axes() ax1.plot(pos, absolute, '-', linewidth=2) # figure lines fi fig2 = plt.figure() pos = np.arange(len(absolute)) x = np.linspace(0, 10) ax = plt.axes() ax.plot(pos, absolute, '--', linewidth=2) plt.show()
thank much!
greetings!
using ipython (jupyter notebook) pretty easy , nice at. keyword bool
need generate checkbox. if click it, changes value , plot shown.
import numpy np import matplotlib.pyplot plt ipywidgets import * %matplotlib inline t = np.arange(100) f=0.01 data = np.sin(2*np.pi*f*t) def plot(lines): fig1= plt.figure() ax = plt.axes() if lines: ax.plot(t,data, '-', linewidth=2) else: ax.plot(t,data, '.', linewidth=2) interact(plot, lines=bool())
Comments
Post a Comment