Matplotlib programming
import numpy as np
import matplotlib.pyplot as plt
a = b = np.arange(0, 3, 0.1)
c = np.exp(a)
d = c[::-1]
fig, ax = plt.subplots()
ax.plot(a, c, 'k--', label='Model length')
ax.plot(a, d, 'k:', label='Data length')
ax.plot(a, c + d, 'k', label='Total message length')
legend = ax.legend(loc='upper center', shadow=True, fontsize='x-large')
legend.get_frame().set_facecolor('#00FFCC')
plt.show()
Python grammar explanations
c[::-1]
Means: taking the element from the front (opposite to) the
d = c[::-1]
will of the elements of the vector c taken backwards, but the index is not less than 0, it is practically equivalent to that of FIG storage index vector function values read upside down , and then presents the results in the figure.