Dela dina visualiseringar med andra

Introduktion till datavisualisering med Matplotlib

Ariel Rokem

Data Scientist

En figur att dela

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

Introduktion till datavisualisering med Matplotlib

Spara figuren till fil

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
Introduktion till datavisualisering med Matplotlib

Olika filformat

fig.savefig("gold_medals.jpg")
fig.savefig("gold_medals.jpg", quality=50)
fig.savefig("gold_medals.svg")
Introduktion till datavisualisering med Matplotlib

Upplösning

fig.savefig("gold_medals.png", dpi=300)
Introduktion till datavisualisering med Matplotlib

Storlek

fig.set_size_inches([5, 3])

Introduktion till datavisualisering med Matplotlib

Ett annat bildförhållande

fig.set_size_inches([3, 5])

Introduktion till datavisualisering med Matplotlib

Nu kör vi en övning!

Introduktion till datavisualisering med Matplotlib

Preparing Video For Download...