Advertisement
Guest User

Untitled

a guest
Sep 22nd, 2017
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.52 KB | None | 0 0
  1. # -*- coding: utf-8 -*-
  2.  
  3. import matplotlib.pyplot as plt
  4. import matplotlib.dates as dates
  5. from datetime import datetime, timedelta
  6.  
  7. x = []
  8. y = []
  9. with open("dataset.csv") as f:
  10. for l in f:
  11. X,Y = l.split(",") #separador eh a virgula
  12. x.append(float(X))
  13. y.append( float (Y))
  14.  
  15. #x1 = [datetime.fromtimestamp(int(d)) for d in x]
  16. x1 = [str(datetime.fromtimestamp(int(d)))[-8:] for d in x]
  17. y_pos = [idx for idx, i in enumerate(y)]
  18.  
  19. plt.figure(figsize=(17,9))
  20. plt.gca().xaxis.set_major_formatter(dates.DateFormatter('%m/%d/%Y %H:%M:%S'))
  21.  
  22. plt.bar(y_pos, y, align='edge', color="blue", alpha=0.5, width=0.5) # <--- EDICAO PRINCIPAL
  23. plt.title("ValoresX TEMPO")
  24. plt.ylabel("Valores")
  25. plt.xlabel('Tempo')
  26. plt.xticks(y_pos, x1, size='small',rotation=35, ha="right")
  27. plt.yticks(y)
  28. plt.ylim(ymax=sorted(y)[-1]+1) # valor maximo do eixo y
  29. #plt.ylim(ymin=sorted(y)[0]-1) # valor minimo do eixo y
  30.  
  31. plt.show()
  32.  
  33. # -*- coding: utf-8 -*-
  34.  
  35. import math
  36. import matplotlib.pyplot as plt
  37. import matplotlib.dates as dates
  38. from datetime import datetime, timedelta
  39. import numpy as np
  40.  
  41. x = []
  42. y = []
  43. with open("dataset.csv") as f:
  44. for l in f:
  45. X,Y = l.split(",") #separador eh a virgula
  46. x.append(float(X))
  47. y.append( float (Y))
  48.  
  49.  
  50. #x1 = [datetime.fromtimestamp(int(d)) for d in x]
  51. x1 = [str(datetime.fromtimestamp(int(d)))[-8:] for d in x]
  52. y_pos = [idx for idx, i in enumerate(y)]
  53.  
  54. plt.figure(figsize=(17,9))
  55. plt.gca().xaxis.set_major_formatter(dates.DateFormatter('%m/%d/%Y %H:%M:%S'))
  56.  
  57. plt.bar(y_pos, y, align='edge', color="blue", alpha=0.5, width=0.5) # <--- EDICAO PRINCIPAL
  58. plt.title("Valores X Tempo")
  59. plt.ylabel("Valores")
  60. plt.xlabel('Tempo')
  61. plt.xticks(y_pos, x1, size='small',rotation=35, ha="right")
  62. #plt.yticks(y)
  63. #plt.yticks(np.arange(0,max(y),0.3))
  64. plt.yticks(np.arange(0,max(y)+5,10))
  65. plt.ylim(ymax=sorted(y)[-1]+1) # valor maximo do eixo y
  66. #plt.ylim(ymin=sorted(y)[0]-1) # valor minimo do eixo y
  67. plt.yscale('log')
  68. plt.show()
  69.  
  70. 1491828000,3
  71. 1491828060,195
  72. 1491828120,220
  73. 1491828180,240
  74. 1491828240,230
  75. 1491828300,238
  76. 1491828360,310
  77. 1491828420,280
  78. 1491828480,263
  79. 1491828540,271
  80. 1491828600,282
  81. 1491828660,302
  82. 1491828720,298
  83. 1491828780,257
  84. 1491828840,245
  85. 1491828900,200
  86. 1491828960,170
  87. 1491829020,138
  88. 1491829080,59
  89. 1491829140,39
  90. 1491829200,48
  91. 1491829260,95
  92. 1491829320,151
  93. 1491829380,155
  94. 1491829440,175
  95. 1491829500,93
  96. 1491829560,25
  97. 1491829620,3
  98. 1491829680,185
  99. 1491829740,233
  100. 1491829800,210
  101. 1491829860,86
  102. 1491829920,32
  103. 1491829980,46
  104. 1491830040,51
  105. 1491830100,201
  106. 1491830160,129
  107. 1491830220,116
  108. 1491830280,105
  109. 1491830340,200
  110. 1491830400,203
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement