Introduction to Data Visualization with Matplotlib
Ariel Rokem
Data Scientist
import matplotlib.pyplot as plt
fig, ax = plt.subplots()
ax.plot(seattle_weather["MONTH"], seattle_weather["MLY-TAVG-NORMAL"])
ax.plot(austin_weather["MONTH"], austin_weather["MLY-TAVG-NORMAL"])
ax.set_xlabel("Time (months)")
ax.set_ylabel("Average temperature (Fahrenheit degrees)")
plt.show()
plt.style.use("ggplot")
fig, ax = plt.subplots() ax.plot(seattle_weather["MONTH"], seattle_weather["MLY-TAVG-NORMAL"]) ax.plot(austin_weather["MONTH"], austin_weather["MLY-TAVG-NORMAL"]) ax.set_xlabel("Time (months)") ax.set_ylabel("Average temperature (Fahrenheit degrees)") plt.show()
plt.style.use("default")
plt.style.use("bmh")
fig, ax = plt.subplots() ax.plot(seattle_weather["MONTH"], seattle_weather["MLY-TAVG-NORMAL"]) ax.plot(austin_weather["MONTH"], austin_weather["MLY-TAVG-NORMAL"]) ax.set_xlabel("Time (months)") ax.set_ylabel("Average temperature (Fahrenheit degrees)") plt.show()
plt.style.use("seaborn-colorblind")
fig, ax = plt.subplots() ax.plot(seattle_weather["MONTH"], seattle_weather["MLY-TAVG-NORMAL"]) ax.plot(austin_weather["MONTH"], austin_weather["MLY-TAVG-NORMAL"]) ax.set_xlabel("Time (months)") ax.set_ylabel("Average temperature (Fahrenheit degrees)") plt.show()
Introduction to Data Visualization with Matplotlib