|
@@ -1274,7 +1274,6 @@ class Statistics:
|
|
|
graphy, graphx = [], []
|
|
|
|
|
|
result = sorted(result, key=lambda row: row[4])
|
|
|
-
|
|
|
|
|
|
for i, row in enumerate(result):
|
|
|
addr1, addr2 = "%s:%d" % (row[0], row[1]), "%s:%d" % (row[2], row[3])
|
|
@@ -1286,39 +1285,18 @@ class Statistics:
|
|
|
graphy.append("%s\n%s" % (addr1, addr2))
|
|
|
graphx.append(row[4])
|
|
|
|
|
|
-
|
|
|
|
|
|
fig, ax = plt.subplots()
|
|
|
ax.xaxis.tick_top()
|
|
|
ax.xaxis.set_label_position("top")
|
|
|
|
|
|
|
|
|
- dist_mult_height, dist_mult_width = 0.55, 0.07
|
|
|
-
|
|
|
-
|
|
|
- if len(graphy) < 10:
|
|
|
- plt_height = 7.5
|
|
|
-
|
|
|
- else:
|
|
|
- plt_height = len(graphy) * dist_mult_height
|
|
|
-
|
|
|
-
|
|
|
- if max(graphx) < 200:
|
|
|
- plt_width = 7.5
|
|
|
- if max(graphx) == 0:
|
|
|
- ax.set_xlim(0, 10)
|
|
|
-
|
|
|
- else:
|
|
|
- plt_width = max(graphx) * dist_mult_width
|
|
|
-
|
|
|
+ dist_mult_height = 0.55
|
|
|
+ plt_height = len(graphy) * dist_mult_height
|
|
|
title_distance = 1 + 0.012*52.8/plt_height
|
|
|
|
|
|
-
|
|
|
- min_width = len(title) * 0.15
|
|
|
- if plt_width < min_width:
|
|
|
- plt_width = min_width
|
|
|
-
|
|
|
- plt.gcf().set_size_inches(plt_width, plt_height)
|
|
|
+ plt.gcf().set_size_inches(plt.gcf().get_size_inches()[0], plt_height)
|
|
|
+ plt.gcf().subplots_adjust(left=0.35)
|
|
|
|
|
|
|
|
|
plt.title(title, y=title_distance)
|
|
@@ -1332,15 +1310,10 @@ class Statistics:
|
|
|
plt.barh(range(len(graphy)), graphx, width, align='center', linewidth=0.5, color='red', edgecolor='red')
|
|
|
|
|
|
plt.yticks(range(len(graphy)), graphy)
|
|
|
-
|
|
|
- try:
|
|
|
- plt.tight_layout(pad=4)
|
|
|
- except (ValueError, numpy.linalg.linalg.LinAlgError):
|
|
|
- pass
|
|
|
|
|
|
|
|
|
out = self.pcap_filepath.replace('.pcap', suffix)
|
|
|
- plt.savefig(out, dpi=500)
|
|
|
+ plt.savefig(out, dpi=500, bbox_inches='tight', pad=0.2)
|
|
|
return out
|
|
|
|
|
|
def plot_packets_per_connection(file_ending: str):
|
|
@@ -1463,7 +1436,7 @@ class Statistics:
|
|
|
|
|
|
|
|
|
out = self.pcap_filepath.replace('.pcap', suffix)
|
|
|
- plt.savefig(out, dpi=500)
|
|
|
+ plt.savefig(out, dpi=500, bbox_inches='tight', pad=0.2)
|
|
|
return out
|
|
|
|
|
|
def plot_histogram_degree(degree_type:str, title:str, label:str, suffix:str):
|
|
@@ -1509,7 +1482,7 @@ class Statistics:
|
|
|
|
|
|
|
|
|
out = self.pcap_filepath.replace('.pcap', suffix)
|
|
|
- plt.savefig(out, dpi=500)
|
|
|
+ plt.savefig(out, dpi=500, bbox_inches='tight', pad=0.2)
|
|
|
return out
|
|
|
|
|
|
ttl_out_path = plot_ttl('.' + file_format)
|