#!/usr/bin/env python3 # takes two columns of points as r theta pairs # and plots them in a unit circle. # Author: Robert Heckendorn for CS472 Nov 6, 2020 import sys import numpy as np import matplotlib.pyplot as plt def main() : # collect data xx = [] yy = [] for inline in sys.stdin : line = inline.split() r = float(line[0]) theta = float(line[1]) x = r * np.cos(theta) y = r * np.sin(theta) xx.append(x) yy.append(y) # plot the circle theta = np.linspace(0, 2*np.pi, 100) x = np.cos(theta) y = np.sin(theta) plt.axes().set_aspect(1.0) plt.plot(x, y) # plot and save the data plt.scatter(xx, yy, c='#ff0000') plt.savefig("unit.png") main()