Přizpůsobení grafů

Introduction to Data Visualization with Matplotlib

Ariel Rokem

Data Scientist

Přizpůsobení vzhledu dat

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

Introduction to Data Visualization with Matplotlib

Přidání značek

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

Introduction to Data Visualization with Matplotlib

Volba značek

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

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

Introduction to Data Visualization with Matplotlib

Nastavení stylu čáry

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

Introduction to Data Visualization with Matplotlib

Odstranění čar pomocí linestyle

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

Introduction to Data Visualization with Matplotlib

Volba barvy

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

Introduction to Data Visualization with Matplotlib

Přizpůsobení popisků os

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

Introduction to Data Visualization with Matplotlib

Nastavení popisku osy y

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

Introduction to Data Visualization with Matplotlib

Přidání názvu

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

Introduction to Data Visualization with Matplotlib

Procvičte si přizpůsobení grafů!

Introduction to Data Visualization with Matplotlib

Preparing Video For Download...