Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # -*- coding: utf-8 -*-
- import matplotlib.pyplot as plt
- import matplotlib.dates as dates
- from datetime import datetime, timedelta
- x = []
- y = []
- with open("datasetDdos10Abril2017_unixtime_slowloris.csv") as f:
- for l in f:
- X,Y = l.split(",") #separador eh a virgula
- x.append(float(X))
- y.append(float (Y))
- x1 = [datetime.fromtimestamp(int(d)) for d in x]
- y_pos = [idx for idx, i in enumerate(y)]
- plt.gca().xaxis.set_major_formatter(dates.DateFormatter('%m/%d/%Y %H:%M:%S'))
- y1 = []
- v = 0
- y_sorted = sorted(y)
- for i in y_sorted:
- if(abs(i-v > 50)):
- y1.append(i)
- v = i
- plt.bar(y_pos, y, align='edge', color="blue", alpha=0.5, width=0.5) # <--- EDICAO PRINCIPAL
- plt.title("Número de Conexões por segundo: Sem Ataques")
- plt.ylabel("Número de Conexões por segundo")
- plt.xlabel('Tempo')
- plt.xticks(y_pos, x1, size='small',rotation=35, ha="right")
- plt.yticks(y1)
- plt.ylim(ymin=y_sorted[0]-200) # valor minimo do eixo y
- plt.show()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement