Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import matplotlib.pyplot as plt
- import math
- # save plot of curve to image
- def curveToImage(curve, filename):
- plt.title(filename)
- plt.xlabel('Year')
- plt.ylabel('Some measurements')
- plt.plot(curve)
- plt.savefig(filename)
- plt.show()
- plt.close()
- return
- def generateCurve():
- # generate curve for sine wave and return the curve
- curve = []
- for i in range(0, 50):
- curve.append(math.sin(i))
- return curve
- sineWavecurve = generateCurve()
- curveToImage(sineWavecurve, 'curveToImageV1.0.png')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement