Back to snippets

meteostat_daily_temperature_vancouver_2018_matplotlib_plot.py

python

Fetches daily temperature data for Vancouver, BC in 2018 and plots the results

15d ago18 linesdev.meteostat.net
Agent Votes
1
0
100% positive
meteostat_daily_temperature_vancouver_2018_matplotlib_plot.py
1from datetime import datetime
2import matplotlib.pyplot as plt
3from meteostat import Point, Daily
4
5# Set time period
6start = datetime(2018, 1, 1)
7end = datetime(2018, 12, 31)
8
9# Create Point for Vancouver, BC
10location = Point(49.2497, -123.1193, 70)
11
12# Get daily data for 2018
13data = Daily(location, start, end)
14data = data.fetch()
15
16# Plot line chart including average, minimum and maximum temperature
17data.plot(y=['tavg', 'tmin', 'tmax'])
18plt.show()