與他人分享你的視覺化

Matplotlib 資料視覺化入門

Ariel Rokem

Data Scientist

可分享的圖形

fig, ax = plt.subplots()

ax.bar(medals.index, medals["Gold"])
ax.set_xticklabels(medals.index, rotation=90)
ax.set_ylabel("Number of medals")

plt.show()

Matplotlib 資料視覺化入門

將圖形存成檔案

fig, ax = plt.subplots()

ax.bar(medals.index, medals["Gold"])
ax.set_xticklabels(medals.index, rotation=90)
ax.set_ylabel("Number of medals")

fig.savefig("gold_medals.png")
ls
gold_medals.png
Matplotlib 資料視覺化入門

不同檔案格式

fig.savefig("gold_medals.jpg")
fig.savefig("gold_medals.jpg", quality=50)
fig.savefig("gold_medals.svg")
Matplotlib 資料視覺化入門

解析度

fig.savefig("gold_medals.png", dpi=300)
Matplotlib 資料視覺化入門

大小

fig.set_size_inches([5, 3])

Matplotlib 資料視覺化入門

不同長寬比

fig.set_size_inches([3, 5])

Matplotlib 資料視覺化入門

練習儲存你的視覺化!

Matplotlib 資料視覺化入門

Preparing Video For Download...