Guangning Yu's Blog
Home
Code
Data
Setup
Industry
MachineLearning
Archive
Plot decay function
2019-02-17 01:40:32
```python import matplotlib.pyplot as plt import numpy as np alpha = [0.99, 0.9, 0.8] x = np.arange(0, 100, 1) y1 = np.vectorize(lambda t: alpha[0]**t)(x) y2 = np.vectorize(lambda t: alpha[1]**t)(x) y3 = np.vectorize(lambda t: alpha[2]**t)(x) lines = plt.plot(x, y1, x, y2, x, y3) plt.title('Decay demo') legend = tuple(['alpha: {}'.format(i) for i in alpha]) plt.legend(legend, loc='upper right') plt.setp(lines[0], linewidth=1, markersize=1) plt.setp(lines[1], linewidth=1, markersize=1) plt.setp(lines[2], linewidth=1, markersize=1) plt.show() ``` ![](/api/file/getImage?fileId=5bf67bf8afa56b594a000038)
Previous:
Crontab basics
Next:
Lodash Basics