You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
51 lines
1.2 KiB
51 lines
1.2 KiB
#!/usr/bin/env
|
|
|
|
import matplotlib.pyplot as plt
|
|
import csv
|
|
import math
|
|
from decimal import Decimal
|
|
|
|
import click
|
|
|
|
@click.group()
|
|
@click.pass_context
|
|
def charts(ctx):
|
|
'''Create graphs and figures.\f'''
|
|
pass
|
|
|
|
@charts.command()
|
|
@click.pass_context
|
|
def efm(ctx):
|
|
plt.style.use('seaborn-whitegrid')
|
|
# x,y axis values
|
|
x = []
|
|
y = []
|
|
|
|
# open & read the csv file
|
|
with open('resources/graph_data.csv','r') as csv_file:
|
|
csv_reader = csv.reader(csv_file, delimiter=',')
|
|
|
|
#loop through all rows. Puts column (0) in x, & column (1) in y.
|
|
for i, row in enumerate(csv_reader):
|
|
y.append(math.log10(Decimal(row[0])))
|
|
x.append(math.log10(Decimal(row[1])))
|
|
|
|
plt.rcParams['axes.facecolor'] = '#ededed'
|
|
plt.ticklabel_format(style='sci', axis='x')
|
|
plt.ticklabel_format(style='sci', axis='y')
|
|
|
|
# plotting the points
|
|
plt.scatter(x,y, s=0.75, color='black')
|
|
|
|
# naming the x,y axis
|
|
plt.xlabel('LR - EuroForMix v2.1.0')
|
|
plt.ylabel('LR - Forensic Statistical Tool v2.0')
|
|
|
|
# giving a title to the graph
|
|
plt.title('EuroForMix Vs. Forensic Statistical Tool')
|
|
|
|
# Graph legend
|
|
plt.legend()
|
|
|
|
# function to show the plot
|
|
plt.show()
|