提升視覺化的效率

用 Python 改善你的資料視覺化

Nick Strayer

Instructor

什麼是高效率?

  • 降低讀懂故事的負擔
  • 重新編排圖表以聚焦
  • 提升「墨水」與資訊比
  • 不犧牲核心訊息

混亂折線經多步驟簡化為直線

用 Python 改善你的資料視覺化

左側報告含三張分開的圖,箭頭指向右側同一報告,三圖合併並置於上方

用 Python 改善你的資料視覺化
# Create a subplot w/ one row & two columns.
f, (ax1, ax2) = plt.subplots(1, 2)

# Pass each axes to respective plot sns.lineplot('month', 'NO2', 'year', ax=ax1, data=pol_by_month)
sns.barplot('year', 'count', ax=ax2, data=obs_by_year)

左為不同年份的污染值折線圖,右為各年份觀測次數長條圖

用 Python 改善你的資料視覺化

移除不必要的圖例

左為不同年份的污染值折線圖,右為各年份觀測次數長條圖;指出右圖可作為左圖圖例

用 Python 改善你的資料視覺化
sns.lineplot('month', 'NO2', 'year', ax=ax1, data=pol_by_month, palette='RdBu',)

sns.barplot('year', 'count', 'year', ax=ax2, data=obs_by_year, palette='RdBu', dodge=False)
# Remove legends for both plots ax1.legend_.remove() ax2.legend_.remove()

左為不同年份的污染值折線圖,右為各年份觀測次數長條圖;長條圖的色彩作為折線圖圖例

用 Python 改善你的資料視覺化

一起來練習吧!

用 Python 改善你的資料視覺化

Preparing Video For Download...