我打算创建2-3个共享在一个共同的时间轴上,可以与单个滑块交互滚动。此外,有一个约束,在采样频率是不同的每个变量,但有相同的时间窗口。
x - time
y1 - values sampled every 1 second
y2 - values sampled every 10 seconds
y3 - values sampled every 100 seconds 我们怎么能这么做。
已经尝试过此示例代码
import matplotlib.pyplot as plt
from ipywidgets import interact
%matplotlib inline
def f(n):
plt.plot([0,1,2],[0,1,n])
plt.show()
interact(f,n=(0,10))我想要类似的东西,唯一的变化是x和y轴数据是常量,滑块小部件用来滚动图的左、右(x轴),在图形显示上有一个特定的时间窗口。
发布于 2018-06-29 04:22:24
下面实现的片段。
发布于 2018-05-31 16:18:26
部分解决了该问题的交互性位。
随着滑块的移动,X轴可以滚动。
%matplotlib inline
from ipywidgets import interactive
import matplotlib.pyplot as plt
import numpy as np
def f(m):
plt.figure(2)
x = np.linspace(-10, 10, num=1000)
plt.plot(x,x)
#plt.plot(x, m * x)
plt.xlim(m+2, m-2)
plt.show()
interactive(f, m=(-2.0, 2.0))https://stackoverflow.com/questions/50590175
复制相似问题