Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import matplotlib.pyplot as plt
- import numpy as np
- def f(x, s):
- return 1. / (1. + float(abs(x - 2.)) / abs(s))
- f = np.vectorize(f)
- x = np.linspace(-8, 10, 1000, endpoint=True)
- plt.plot(x, f(x, 0.25), label='s=0.25')
- plt.plot(x, f(x, 1.00), label='s=1.00')
- plt.plot(x, f(x, 4.00), label='s=4.00')
- plt.legend(loc='best')
- plt.show()
- x = []
- y = []
- c = []
- with open('input.txt') as f:
- for line in f:
- x.append(float(line.split('\t')[0]))
- y.append(float(line.split('\t')[1]))
- if line.split('\t')[2] == '1':
- c.append(1)
- elif line.split('\t')[3] == '1':
- c.append(2)
- else:
- c.append(3)
- plt.scatter(x, y, c = c)
- plt.show()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement