指数曲线拟合到python中的日期时间图

时间:2015-07-24 05:57:56

标签: python datetime matplotlib

如何将指数拟合曲线绘制到日期时间直方图?

    numtime = [date2num(t) for t in x] #x is <type 'numpy.ndarray'> of datetime

    # plotting the histogram
    ax = figure().gca()
    x, y, patches = hist(numtime, bins=24,alpha=.5)
    # adding the labels for the x axis
    tks = [num2date(p.get_x()) for p in patches] 
    xticks(tks,rotation=40)
    # formatting the dates on the x axis
    ax.xaxis.set_major_formatter(DateFormatter('%d %b %H:%M'))
    show()

DirectX Tool Kit enter image description here是我所知道的。但我完全不确定如何在直方图的情况下这样做。

编辑:

print x,y
[  1.51200000e+03   4.27000000e+02   9.30000000e+01   1.22000000e+02
   2.40000000e+01   4.66000000e+02   5.00000000e+01   3.00000000e+00
   8.00000000e+00   1.20000000e+01   0.00000000e+00   0.00000000e+00
   3.00000000e+00   1.40000000e+01   2.00000000e+00   1.00000000e+00
   1.00000000e+00   0.00000000e+00   0.00000000e+00   0.00000000e+00
   0.00000000e+00   1.00000000e+00   0.00000000e+00   0.00000000e+00
   0.00000000e+00   1.00000000e+00   0.00000000e+00   0.00000000e+00
   0.00000000e+00   1.00000000e+00   1.00000000e+00   1.00000000e+00
   0.00000000e+00   0.00000000e+00   0.00000000e+00   0.00000000e+00
   0.00000000e+00   0.00000000e+00   0.00000000e+00   1.00000000e+00
   0.00000000e+00   1.00000000e+00   0.00000000e+00   1.00000000e+00
   0.00000000e+00   0.00000000e+00   0.00000000e+00   1.00000000e+00
   4.00000000e+00   6.00000000e+00] [ 735599.5875      735603.10506944  735606.62263889  735610.14020833
  735613.65777778  735617.17534722  735620.69291667  735624.21048611
  735627.72805556  735631.245625    735634.76319444  735638.28076389
  735641.79833333  735645.31590278  735648.83347222  735652.35104167
  735655.86861111  735659.38618056  735662.90375     735666.42131944
  735669.93888889  735673.45645833  735676.97402778  735680.49159722
  735684.00916667  735687.52673611  735691.04430556  735694.561875
  735698.07944444  735701.59701389  735705.11458333  735708.63215278
  735712.14972222  735715.66729167  735719.18486111  735722.70243056
  735726.22        735729.73756944  735733.25513889  735736.77270833
  735740.29027778  735743.80784722  735747.32541667  735750.84298611
  735754.36055556  735757.878125    735761.39569444  735764.91326389
  735768.43083333  735771.94840278  735775.46597222]

0 个答案:

没有答案