如何折叠给定时间段的散点图?

时间:2016-06-16 23:04:34

标签: python matplotlib plot

我正在绘制给定点作为数组的图形,该图形达到最小值并再次上升。经过一段时间后,图形重复(不完全但几乎重复,它与我绘制的一样重要),我想要做的是折叠曲线,使所有重复的部分都绘制在第一个最小值上。细节和变量是

y = [....array...]                  #y axis data points
t = [57224.3244,57224.5165,.....,57296.8754]   #time data points(x axis)   
t0 = 57233.7693             # here is the first minimum in curve
time = t-t0                 # reduce each t by t0 & gives the x axis range from -10 to 85
period = 16                 # second minimum at x= 16 and then x = 32 and so on
                            # at t = t0 or say at x = 0 the curve has a minima
                            # the plot is a curve from about x = -8 to 8 with minima at x=0
                            # the period is 16 means that the characterstic of graph repeats

我正在使用

进行策划
plt.scatter(time,y)

在x = 8到x = 16之后,绘图以相同的方式重复,其行为与从x = -8到x = 8的情况相同,x = 16到x = 24的情况相同。我想要的是所有的其他周期点在第一组点上绘制,并且必须使用t-t0方式完成,因为它在x = 0时给出第一个最小值,将x点转换为从-10到85的简单点,在其他地方也很重要。 xlim应该类似于x = -8到x = 8,最小值x = 0.但折叠曲线本身让我感到担忧。我试过了

for each in time:
    if each > 8 and each =< 16:
        each = each - 16                    # to make the points in between -8 to 8
    elif each > 16 and each =<32:
        each = each - 24                   # again to make points between -8 to 8 
    elif each > 32 and each =<48:
        each = each - 40
    ...... # similarly 

但它给了我一些与a.any()和a.all()相关的错误。我尝试过其他东西,但没有任何效果。请帮忙。谢谢

0 个答案:

没有答案