from sys import argv
import matplotlib.pyplot as plt
from math import pi, degrees
from numpy import arctan2

plt.style.use('ggplot')

label_index = int(argv[1])
remove_last = int(argv[2])
alpha_value = argv[3]

all_labels = ["$\\xi (t) = 0$",
              "$\\xi (t) = t$",
              "$\\xi (t) = \cos(t)$",
              "$\\xi (t) = \cos(\pi t)$",
              "$\\xi (t) = t \ \cos(t)$",
              "$\\xi (t) = t \ \cos(\pi t)$",
              "$\\xi (t) = \sin(t)$",
              "$\\xi (t) = \sin(\pi t)$",
              "$\\xi (t) = t \ \sin(t)$",
              "$\\xi (t) = t \ \sin(\pi t)$",
              "$\\xi (t) = 2 \ \sqrt{1 \ (1 - t)}$",
              "$\\xi (t) = 2 \ \sqrt{2.5 \ (1 - t)}$",
              "$\\xi (t) = 2 \ \sqrt{3.5 \ (1 - t)}$",
              "$\\xi (t) = 2 \ \sqrt{4 \ (1 - t)}$",
              "$\\xi (t) = 2 \ \sqrt{4.5 \ (1 - t)}$",
              "$\\xi (t) = 2 \ \sqrt{6 \ (1 - t)}$",
              "$\\xi (t) = 2 \ \sqrt{8 \ (1 - t)}$",
              "$\\xi (t) = c_{" + alpha_value + "} \sqrt{t}$"]

all_filenames = ["zero",
                 "t",
                 "cos(t)",
                 "cos(pi * t)",
                 "t * cos(t)",
                 "t * cos(pi * t)",
                 "sin(t)",
                 "sin(pi * t)",
                 "t * sin(t)",
                 "t * sin(pi * t)",
                 "2 * sqrt(1 * (1 - t))",
                 "2 * sqrt(2.5 * (1 - t))",
                 "2 * sqrt(3.5 * (1 - t))",
                 "2 * sqrt(4 * (1 - t))",
                 "2 * sqrt(4.5 * (1 - t))",
                 "2 * sqrt(6 * (1 - t))",
                 "2 * sqrt(8 * (1 - t))",
                 "c" + alpha_value + "-sqrt(t)"]

results_file = open('result.txt', 'r')

real_values = []
imag_values = []

for line in results_file:

    values = line.split()

    real_values.append(float(values[0]))
    imag_values.append(float(values[1]))

if remove_last == 1:

    real_values.pop()
    imag_values.pop()

if label_index >= 17:
    max_x = real_values[-1]
    max_y = real_values[-1]
    angle = arctan2(max_y , max_x) / pi
    alpha_data = [alpha_value, str(angle)]
    plt.axis((-5,5,0,6))

partial_filename = "output/" + all_filenames[label_index]

# plt.figure(figsize=(4.5, 3))

plt.title(all_labels[label_index],fontsize = 12, color='black', y = 1.02)
plt.plot(real_values,imag_values)
# plt.axis('equal')
plt.savefig(partial_filename + ".png")

## Test!

exit()

plt.cla()
plt.title(all_labels[label_index],fontsize = 14, color='black', y = 1.03)
plt.scatter(real_values,imag_values)
plt.savefig(partial_filename + " [scatter].png")
# plt.axis('equal')

@@ -181,21 +181,27 @@
 rgv%5B2%5D)%0A
-alpha
+square_root
 _value =
@@ -316,50 +316,8 @@
 $%22,%0A
-              %22$%5C%5Cxi (t) = %5Ccos(%5Cpi t)$%22,%0A
     
@@ -376,28 +376,24 @@
 %22$%5C%5Cxi (t) =
- t %5C
  %5Ccos(%5Cpi t)
@@ -427,55 +427,59 @@
 ) = 
-%5Csin(t)$%22,%0A              %22$%5C%5Cxi (t) = %5Csin(%5Cpi 
+t %5C %5Ccos(%5Cpi t)$%22,%0A              %22$%5C%5Cxi (t) = %5Csin(
 t)$%22
@@ -544,28 +544,24 @@
 %22$%5C%5Cxi (t) =
- t %5C
  %5Csin(%5Cpi t)
@@ -595,193 +595,23 @@
 ) = 
-2 %5C %5Csqrt%7B1 %5C (1 - t)%7D$%22,%0A              %22$%5C%5Cxi (t) = 2 %5C %5Csqrt%7B2.5 %5C (1 - t)%7D$%22,%0A              %22$%5C%5Cxi (t) = 2 %5C %5Csqrt%7B3.5 %5C (1 - t)%7D$%22,%0A              %22$%5C%5Cx
+t %5C %5Csin(%5Cp
 i 
-(
 t)
- = 2 %5C %5Csqrt%7B4 %5C (1 - t)%7D
 $%22,%0A
@@ -651,117 +651,33 @@
 qrt%7B
-4.5 %5C (1 - t)%7D$%22,%0A              %22$%5C%5Cxi (t) = 2 %5C %5Csqrt%7B6 %5C (1 - t)%7D$%22,%0A              %22$%5C%5Cxi (t) = 2 %5C %5Csqrt%7B8
+%22 + square_root_value + %22
  %5C (
@@ -717,29 +717,35 @@
 t) = c_%7B%22 + 
-alpha
+square_root
 _value + %22%7D 
@@ -835,40 +835,8 @@
 )%22,%0A
-                 %22cos(pi * t)%22,%0A
     
@@ -876,28 +876,24 @@
            %22
-t * 
 cos(pi * t)%22
@@ -916,38 +916,15 @@
    %22
-sin(t)%22,%0A                 %22sin
+t * cos
 (pi 
@@ -944,28 +944,24 @@
            %22
-t * 
 sin(t)%22,%0A   
@@ -983,21 +983,16 @@
 t * sin(
-pi * 
 t)%22,%0A   
@@ -1010,28 +1010,18 @@
    %22
-2 * sqrt(1 * (1 - t)
+sin(pi * t
 )%22,%0A
@@ -1042,234 +1042,78 @@
    %22
-2 * sqrt(2.5 * (1 - t))%22,%0A                 %222 * sqrt(3.5 * (1 - t))%22,%0A                 %222 * sqrt(4 * (1 - t))%22,%0A                 %222 * sqrt(4.5 * (1 - t))%22,%0A                 %222 * sqrt(6 * (1 - t))%22,%0A                 %222 * sqrt(8
+t * sin(pi * t)%22,%0A                 %222 * sqrt(%22 + square_root_value + %22
  * (
@@ -1145,21 +1145,27 @@
   %22c%22 + 
-alpha
+square_root
 _value +

Generalised plot labels