Added Box Plot for Messages Sent by Each Node

This commit is contained in:
Sudipta Basak 2024-02-21 12:54:02 +01:00
parent 11afac03b9
commit 7c33fec8da
No known key found for this signature in database
1 changed files with 16 additions and 0 deletions

View File

@ -93,6 +93,7 @@ class Visualizor:
self.plotRestoreRowCount(result, plotPath)
self.plotRestoreColumnCount(result, plotPath)
self.plotMessagesSent(result, plotPath)
self.plotBoxMessagesSent(result, plotPath)
self.plotMessagesRecv(result, plotPath)
self.plotBoxMessagesRecv(result, plotPath)
self.plotSampleRecv(result, plotPath)
@ -396,6 +397,21 @@ class Visualizor:
conf["yaxismax"] = maxi
plotData(conf)
print("Plot %s created." % conf["path"])
def plotBoxMessagesSent(self, result, plotPath):
"""Box Plot of the number of messages sent by all nodes"""
conf = {}
text = str(result.shape).split("-")
conf["textBox"] = "Row Size: "+text[2]+"\nColumn Size: "+text[6]+"\nNumber of nodes: "+text[10]\
+"\nFailure rate: "+text[14]+"%"+" \nNetwork degree: "+text[32]+"\nMalicious Nodes: "+text[36]+"%"
conf["title"] = "Number of Messages Sent by Nodes"
conf["xlabel"] = "Node Type"
conf["ylabel"] = "Number of Messages Sent"
n1 = int(result.numberNodes * result.class1ratio)
conf["data"] = [result.msgSentCount[1: n1], result.msgSentCount[n1: ]]
conf["path"] = plotPath + "/box_messagesSent.png"
plotBoxData(conf)
print("Plot %s created." % conf["path"])
def plotMessagesRecv(self, result, plotPath):
"""Plots the number of messages received by all nodes"""