Chú thích dữ liệu chuỗi thời gian

Nhập môn trực quan hóa dữ liệu với Matplotlib

Ariel Rokem

Data Scientist

Dữ liệu chuỗi thời gian

Nhập môn trực quan hóa dữ liệu với Matplotlib

Chú thích

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()

Nhập môn trực quan hóa dữ liệu với Matplotlib

Đặt vị trí văn bản

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

Nhập môn trực quan hóa dữ liệu với Matplotlib

Thêm mũi tên vào chú thích

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

Nhập môn trực quan hóa dữ liệu với Matplotlib

Tùy chỉnh mũi tên

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

Nhập môn trực quan hóa dữ liệu với Matplotlib

Tùy chỉnh chú thích

Nhập môn trực quan hóa dữ liệu với Matplotlib

Luyện tập chú thích biểu đồ!

Nhập môn trực quan hóa dữ liệu với Matplotlib

Preparing Video For Download...