Partajarea vizualizărilor cu alții

Introducere în vizualizarea datelor cu Matplotlib

Ariel Rokem

Data Scientist

O figură de partajat

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

Introducere în vizualizarea datelor cu Matplotlib

Salvarea figurii în fișier

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
Introducere în vizualizarea datelor cu Matplotlib

Formate de fișier diferite

fig.savefig("gold_medals.jpg")
fig.savefig("gold_medals.jpg", quality=50)
fig.savefig("gold_medals.svg")
Introducere în vizualizarea datelor cu Matplotlib

Rezoluție

fig.savefig("gold_medals.png", dpi=300)
Introducere în vizualizarea datelor cu Matplotlib

Dimensiune

fig.set_size_inches([5, 3])

Introducere în vizualizarea datelor cu Matplotlib

Alt raport de aspect

fig.set_size_inches([3, 5])

Introducere în vizualizarea datelor cu Matplotlib

Exersați salvarea vizualizărilor!

Introducere în vizualizarea datelor cu Matplotlib

Preparing Video For Download...