import numpy as np
import matplotlib.pyplot as plt
n = 1000
x = np.arange(0, n)
y1 = np.random.normal(50, 4, n)
y2 = np.random.normal(25, 2.5, n)
y3 = np.random.normal(10, 1.1, n)
fig, (ax1, ax2, ax3) = plt.subplots(nrows = 3, ncols = 1)
ax1.plot(x, y1, 'royalblue')
ax1.set(xticks = [], title = 'Title')
ax2.plot(x, y2, 'darkorange')
ax2.set(xticks = [])
ax3.plot(x, y3, 'forestgreen')
ax3.set(xlabel = 'Random sample')
fig.legend(['First', 'Second', 'Third'])
plt.show()
Я бы хотел, чтобы ylabels
отображался в процентах, начинался с 0% и уменьшался. Например синий должен идти от [30, 40, 50, 60, 70]
до [-57.1%, -42.9%, -28.6%, -14.3%, 0%]
. Желтый должен перейти от [10, 20, 30, 40]
до [-75%, -50%, -25%, 0%]
, а зеленый - от [5, 7.5, 10, 12.5, 15]
до [-66.6%, -50%, -33.3%, -16.7%, 0%]
.
Остальные графики должны выглядеть точно так же, только ylabels
должен измениться.
