Learn practical skills, build real-world projects, and advance your career

Data Visualizations

Data visualization contest by Jovian.ml

Day 1 : Line chart

Monthly mean temperatures of India from 1997 to 2017 🌡

Dataset : https://visualize.data.gov.in/?inst=634f07b7-c134-48c1-8f8c-6cded810d3e3


Clearly, it's getting hotter

# Import libraries
import matplotlib.pyplot as plt
import matplotlib
import pandas as pd
%matplotlib inline
matplotlib.rcParams['figure.figsize'] = (14, 8)
df = pd.DataFrame({
 '2007': [19.24, 20.97, 23.52, 27.72, 28.84, 28.31, 27.66, 27.37, 26.61, 24.92, 22.40, 19.65], 
 '2008': [18.49, 19.83, 24.43, 26.54, 28.42, 28.10, 27.50, 27.00, 26.44, 25.47, 22.51, 20.62], 
 '2009': [19.79, 21.66, 24.55, 27.35, 28.71, 28.77, 27.83, 27.85, 27.11, 25.20, 22.31, 20.22], 
 '2010': [19.15, 21.23, 26.53, 28.40, 29.19, 28.51, 27.55, 27.33, 26.60, 25.58, 22.98, 19.22], 
 '2011': [18.32, 20.79, 24.11, 26.10, 28.92, 28.60, 27.60, 27.20, 26.70, 25.51, 22.84, 19.84], 
 '2012': [18.25, 20.43, 23.98, 26.89, 28.72, 28.91, 27.98, 27.31, 26.65, 24.85, 22.26, 19.91], 
 '2013': [18.88, 21.07, 24.53, 26.97, 29.06, 28.24, 27.50, 27.22, 26.87, 25.63, 22.18, 19.69], 
 '2014': [18.81, 20.35, 23.34, 26.91, 28.45, 29.42, 28.07, 27.42, 26.61, 25.38, 22.53, 19.50], 
 '2015': [19.02, 21.23, 23.52, 26.52, 28.82, 28.15, 28.03, 27.64, 27.04, 25.82, 22.95, 20.21],  
 '2016': [20.92, 23.58, 26.61, 29.56, 30.41, 29.70, 28.18, 28.17, 27.72, 26.81, 23.90, 21.89], 
 '2017': [20.59, 23.08, 25.58, 29.17, 30.47, 29.44, 28.31, 28.12, 28.11, 27.24, 23.92, 21.47]
   }, index=['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'])
lines = df.plot.line(marker='o', markersize=4, linewidth=0.5)
plt.ylabel('Temperature in Celsius')
plt.xlabel('Month')
plt.title("Analysis of monthly mean temperatures from 2007-2017 - India")
plt.savefig('plot_name.png', dpi = 300)
Notebook Image

🔎 Observations from the line graph

We can understand the following facts from the analysis above:

  • Warmest month : May 2017
  • Coldest month : Jan 2012
  • Coldest summer : June 2008
  • Warmest winter : Dec 2016