Je plots aanpassen

Introductie tot datavisualisatie met Matplotlib

Ariel Rokem

Data Scientist

Dataweergave aanpassen

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

Introductie tot datavisualisatie met Matplotlib

Markers toevoegen

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

Introductie tot datavisualisatie met Matplotlib

Markers kiezen

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

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

Introductie tot datavisualisatie met Matplotlib

Lijntype instellen

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

Introductie tot datavisualisatie met Matplotlib

Lijnen weglaten met lijntype

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

Introductie tot datavisualisatie met Matplotlib

Kleur kiezen

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

Introductie tot datavisualisatie met Matplotlib

Aslabels aanpassen

ax.set_xlabel("Tijd (maanden)")
plt.show()

Introductie tot datavisualisatie met Matplotlib

Y-aslabel instellen

ax.set_xlabel("Tijd (maanden)")
ax.set_ylabel("Gemiddelde temperatuur (graden Fahrenheit)")
plt.show()

Introductie tot datavisualisatie met Matplotlib

Een titel toevoegen

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

Introductie tot datavisualisatie met Matplotlib

Laten we oefenen!

Introductie tot datavisualisatie met Matplotlib

Preparing Video For Download...