import matplotlib.pyplot as plt
import numpy as np

# Read data
size = []
time = []
with open("pi_linear.txt") as file:
    for line in file.readlines():
        x, y = line.split(',')
        size.append(int(x.strip()))   
        time.append(float(y.strip()))   

# Plot data
fig, ax = plt.subplots()
ax.plot(size, time)

ax.set(xlabel='Num. processes', ylabel='Time (s)',
       title='Pi linear')
#ax.grid()

fig.savefig("pi_linear.png")
plt.show()

[(14, 'matplotlib.pyplot.subplots', 'plt.subplots', True, 'import matplotlib.pyplot as plt\n'), (22, 'matplotlib.pyplot.show', 'plt.show', True, 'import matplotlib.pyplot as plt\n')]