aboutsummaryrefslogtreecommitdiff
path: root/src/admin/report/barplot.py
diff options
context:
space:
mode:
authorDavi Antônio da Silva Santos <antoniossdavi@gmail.com>2023-03-29 19:40:59 +0000
committerDavi Antônio da Silva Santos <antoniossdavi@gmail.com>2023-03-29 19:40:59 +0000
commit63062eddfd064c6ebb8114009cf143eca91c2686 (patch)
tree752f3dbac03a25b8926b05f81c03f90c27135dc1 /src/admin/report/barplot.py
parent194f6764b13e070f77b6ab77207918ddf58a288e (diff)
parenta9bb286113e9e8267a6cc45f5b401bdd448a9f8a (diff)
downloadboca-63062eddfd064c6ebb8114009cf143eca91c2686.tar.gz
boca-63062eddfd064c6ebb8114009cf143eca91c2686.zip
Merge remote-tracking branch 'upstream/master'
Synchronise with upstream.
Diffstat (limited to 'src/admin/report/barplot.py')
-rw-r--r--src/admin/report/barplot.py32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/admin/report/barplot.py b/src/admin/report/barplot.py
new file mode 100644
index 0000000..d07f156
--- /dev/null
+++ b/src/admin/report/barplot.py
@@ -0,0 +1,32 @@
+import matplotlib.pyplot as plt
+import sys
+
+filename = sys.argv[1]
+title = sys.argv[2]
+
+
+x = [str(x) + '-' + str(x+10) for x in range(0,300,10)]
+
+with open(filename,'r') as file:
+ y = [int(line) for line in file]
+
+# Create a bar plot
+plt.bar(x, y,width=0.5)
+
+
+# Set the y-axis tick labels to step by 5
+plt.xticks(rotation=90)
+if(max(y)<200):
+ plt.yticks(range(0, max(y)+1, 5))
+else:
+ plt.yticks(range(0, max(y)+1, 10))
+# Add gridlines to the y-axis
+plt.grid(axis='y')
+
+# Add a title to the plot
+plt.title(title)
+
+plt.tight_layout()
+
+# Show the plot
+plt.savefig(filename.replace('.txt','.png'),dpi=600,transparent=True)