Personalizarea graficelor

Introducere în vizualizarea datelor cu Matplotlib

Ariel Rokem

Data Scientist

Personalizarea aspectului datelor

ax.plot(seattle_weather["MONTH"], 
        seattle_weather["MLY-PRCP-NORMAL"])
plt.show()

Introducere în vizualizarea datelor cu Matplotlib

Adăugarea marcatorilor

ax.plot(seattle_weather["MONTH"], 
        seattle_weather["MLY-PRCP-NORMAL"], 
        marker="o")
plt.show()

Introducere în vizualizarea datelor cu Matplotlib

Alegerea marcatorilor

ax.plot(seattle_weather["MONTH"], 
        seattle_weather["MLY-PRCP-NORMAL"], 
        marker="v")
plt.show()

https://matplotlib.org/api/markers_api.html

Introducere în vizualizarea datelor cu Matplotlib

Setarea stilului liniei

fig, ax = plt.subplots()
ax.plot(seattle_weather["MONTH"], 
        seattle_weather["MLY-TAVG-NORMAL"],
        marker="v", linestyle="--")
plt.show()

Introducere în vizualizarea datelor cu Matplotlib

Eliminarea liniilor cu linestyle

fig, ax = plt.subplots()
ax.plot(seattle_weather["MONTH"], 
        seattle_weather["MLY-TAVG-NORMAL"],
        marker="v", linestyle="None")
plt.show()

Introducere în vizualizarea datelor cu Matplotlib

Alegerea culorii

fig, ax = plt.subplots()
ax.plot(seattle_weather["MONTH"], 
        seattle_weather["MLY-TAVG-NORMAL"],
        marker="v", linestyle="--", color="r")
plt.show()

Introducere în vizualizarea datelor cu Matplotlib

Personalizarea etichetelor axelor

ax.set_xlabel("Time (months)")
plt.show()

Introducere în vizualizarea datelor cu Matplotlib

Setarea etichetei axei y

ax.set_xlabel("Time (months)")
ax.set_ylabel("Average temperature (Fahrenheit degrees)")
plt.show()

Introducere în vizualizarea datelor cu Matplotlib

Adăugarea unui titlu

ax.set_title("Weather in Seattle")
plt.show()

Introducere în vizualizarea datelor cu Matplotlib

Exersați personalizarea graficelor!

Introducere în vizualizarea datelor cu Matplotlib

Preparing Video For Download...