Skip to content

Instantly share code, notes, and snippets.

@proywm

proywm/pyplot Secret

Created September 1, 2020 15:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save proywm/49be64968550ae683b34be6fbb517daf to your computer and use it in GitHub Desktop.
Save proywm/49be64968550ae683b34be6fbb517daf to your computer and use it in GitHub Desktop.
import matplotlib
import matplotlib.pyplot as plt
plt.style.use('seaborn-whitegrid')
import numpy as np
axes = plt.axes()
axes.set_ylim([0, 1.1])
fname= "h1/f1"
pname= "h1/p"
rname= "h1/r"
with open(fname, 'r') as file_name:
fn_value = np.genfromtxt(file_name, dtype=np.float)
with open(pname, 'r') as file_name:
p_value = np.genfromtxt(file_name, dtype=np.float)
with open(rname, 'r') as file_name:
r_value = np.genfromtxt(file_name, dtype=np.float)
y, x = np.split(fn_value,[-1],axis=1)
yP, xP = np.split(p_value,[-1],axis=1)
yR, xR = np.split(r_value,[-1],axis=1)
plt.plot(y, x, '-o', color = 'r', label='F1 Score', markersize=8);
plt.plot(yP, xP, '-^', color = 'g', label='Precision', markersize=8);
plt.plot(yR, xR, '-v', color = 'b', label='Recall', markersize=8);
plt.xlabel(r'Threshold $\tau$')
plt.legend(loc='lower right')
plt.savefig('Accuracy_Spec_go_H1.pdf')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment