Skip to content

Instantly share code, notes, and snippets.

@juanpabloaj
Created November 21, 2012 12:55
Show Gist options
  • Select an option

  • Save juanpabloaj/4124724 to your computer and use it in GitHub Desktop.

Select an option

Save juanpabloaj/4124724 to your computer and use it in GitHub Desktop.
matplotlib pyplot
2
4
1.1
5
10
3.2
1.4
0.2
0.2
1.6
1.3
3
3.4
2
1.8
1
#!/usr/bin/python
# -*- coding: utf-8 -*-
import matplotlib.pyplot as plt
def archivo_a_lista(archivo):
lista = []
for l in archivo.readlines():
lista.append(float(l))
return lista
a1 = open('001.txt','r')
a2 = open('002.txt','r')
l1 = archivo_a_lista(a1)
l2 = archivo_a_lista(a2)
l3 = []
for i in range(len(l1)):
l3.append(abs(l1[i] - l2[i]))
plt.subplot(311)
plt.plot(l1)
plt.subplot(312)
plt.plot(l2)
plt.subplot(313)
plt.plot(l3,'ro')
plt.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment