Vẽ thống kê

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

Ariel Rokem

Data Scientist

Thêm thanh lỗi vào biểu đồ cột

fig, ax = plt.subplots()

ax.bar("Rowing",
       mens_rowing["Height"].mean(),
       yerr=mens_rowing["Height"].std())

ax.bar("Gymnastics",
       mens_gymnastics["Height"].mean(),
       yerr=mens_gymnastics["Height"].std())

ax.set_ylabel("Height (cm)")

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

Thanh lỗi trong biểu đồ cột

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

Thêm thanh lỗi vào đồ thị

fig, ax = plt.subplots()

ax.errorbar(seattle_weather["MONTH"],
            seattle_weather["MLY-TAVG-NORMAL"],
            yerr=seattle_weather["MLY-TAVG-STDDEV"])

ax.errorbar(austin_weather["MONTH"],
            austin_weather["MLY-TAVG-NORMAL"],
            yerr=austin_weather["MLY-TAVG-STDDEV"])

ax.set_ylabel("Temperature (Fahrenheit)")

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

Thanh lỗi trong đồ thị

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

Thêm boxplot

fig, ax = plt.subplots()

ax.boxplot([mens_rowing["Height"], mens_gymnastics["Height"]])
ax.set_xticklabels(["Rowing", "Gymnastics"]) ax.set_ylabel("Height (cm)") plt.show()
Nhập môn trực quan hóa dữ liệu với Matplotlib

Diễn giải boxplot

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

Tự thực hành!

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

Preparing Video For Download...