Анотування часових рядів

Вступ до візуалізації даних з Matplotlib

Ariel Rokem

Data Scientist

Дані часових рядів

Вступ до візуалізації даних з Matplotlib

Анотація

fig, ax = plt.subplots()
plot_timeseries(ax, climate_change.index, climate_change['co2'],
               'blue', 'Time', 'CO2 (ppm)')
ax2 = ax.twinx()
plot_timeseries(ax2, climate_change.index, 
                climate_change['relative_temp'],
               'red', 'Time', 'Relative temperature (Celsius)')

ax2.annotate(">1 degree", xy=(pd.Timestamp("2015-10-06"), 1))
plt.show()

Вступ до візуалізації даних з Matplotlib

Розташування тексту

ax2.annotate(">1 degree",
             xy=(pd.Timestamp('2015-10-06'), 1),
             xytext=(pd.Timestamp('2008-10-06'), -0.2))

Вступ до візуалізації даних з Matplotlib

Додавання стрілок до анотації

ax2.annotate(">1 degree",
             xy=(pd.Timestamp('2015-10-06'), 1),
             xytext=(pd.Timestamp('2008-10-06'), -0.2),
             arrowprops={})

Вступ до візуалізації даних з Matplotlib

Налаштування властивостей стрілок

ax2.annotate(">1 degree",
             xy=(pd.Timestamp('2015-10-06'), 1),
             xytext=(pd.Timestamp('2008-10-06'), -0.2),
             arrowprops={"arrowstyle":"->", "color":"gray"})

Вступ до візуалізації даних з Matplotlib

Налаштування анотацій

Вступ до візуалізації даних з Matplotlib

Попрактикуймося в анотуванні графіків!

Вступ до візуалізації даних з Matplotlib

Preparing Video For Download...