Peformed Cpu usage with time plot with basic python(20th September)

In order to learn the usage of matplotlib.pyplot, I have plotted a graph with Google Chrome’s CPU Usage Vs. Time

Code->

import matplotlib.pyplot as plt
x=[]
y=[]
for line in open('CPUData.dat','r'):
lines = [i for i in line.split()]
x.append(int(lines[0]))
y.append(float(lines[1]))
plt.title("CPU_UsageVSTime")
plt.xlabel("Time")
plt.ylabel("CPU_Usage")
plt.plot(x,y,marker='o',c='g')
plt.show()

Leave a Reply

Your email address will not be published. Required fields are marked *