Настройка графиков

Введение в визуализацию данных с Matplotlib

Ariel Rokem

Data Scientist

Настройка внешнего вида данных

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

Введение в визуализацию данных с Matplotlib

Добавление маркеров

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

Введение в визуализацию данных с Matplotlib

Выбор маркеров

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

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

Введение в визуализацию данных с Matplotlib

Настройка стиля линии

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

Введение в визуализацию данных с Matplotlib

Удаление линий с помощью linestyle

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

Введение в визуализацию данных с Matplotlib

Выбор цвета

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

Введение в визуализацию данных с Matplotlib

Настройка подписей осей

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

Введение в визуализацию данных с Matplotlib

Подпись оси Y

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

Введение в визуализацию данных с Matplotlib

Добавление заголовка

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

Введение в визуализацию данных с Matplotlib

Давайте потренируемся!

Введение в визуализацию данных с Matplotlib

Preparing Video For Download...