Wednesday, March 13, 2013

Basic Plotting One -- y = sqrt(x) * 10

After grading the homework, I realized that a curve on the scores is a must...

The curve function is designed to be y = sqrt(x) * 10, 0 <= x <= 100. What does it look like? 

1) Google is always the best friend: Type y = sqrt(x) * 10 in the search box, you will see the plot.

2) An alternative is to use R plot function and save the plot in eps:

curve_func <- function(x) { return 10 * sqrt(x) }
setEPS()
postscript('curve.eps')
plot(curve_func, 0, 100, main = "curve_func(x) = 10 * sqrt(x)", xlab = 'original score', ylab = 'curved score')
dev.off()





3) Another way of doing it in Python:
import matplotlib.pyplot as plt
x = [0.01 * z for z in range(10000)]
y = [0.1 * sqrt(z) for z in range(10000)]
plt.plot(x, y)
plt.show()