From e3bdd4846dd4d21e1fcbf28804d4728e82bda38f Mon Sep 17 00:00:00 2001 From: Bruno Ribas Date: Wed, 29 Mar 2023 10:30:59 -0300 Subject: barplot.py: moved to the correct location --- src/admin/barplot.py | 32 -------------------------------- src/admin/report/barplot.py | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 32 insertions(+), 32 deletions(-) delete mode 100644 src/admin/barplot.py create mode 100644 src/admin/report/barplot.py diff --git a/src/admin/barplot.py b/src/admin/barplot.py deleted file mode 100644 index d07f156..0000000 --- a/src/admin/barplot.py +++ /dev/null @@ -1,32 +0,0 @@ -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) 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) -- cgit v1.2.3