Visualizing Average Temperature in Mexico
By: José Roberto Ayala Solares
Tags: Rstats, México, Temperature, Climate Change, Data Visualization

In this analysis, I explore the average temperature in the 32 states of Mexico since 1985.

Mexico is one of the countries with one of the most diverse climate systems in the world. One of the contributing factors is the geographic location of the country, situated in an area crossed by the Tropic of Cancer.

“Mexico presents a great variety of climates; arid in the north of the territory, hot humid and subhumid in the south/southeast, and cold or warm climates in the high geographical regions.” Instituto Nacional de Estadística y Geografía (INEGI)

For the same reason, it is possible to find cold climates a few hundred kilometers away from hot climates. In addition, some states of the Mexican Republic can show great climatic variability.

Most notable for its variations is the climate of the state of Durango, where the lowest temperatures in the country occur, sometimes reaching -26ºC, and the highest in the desert of Mexicali, Baja California that sometimes surpasses 50ºC. Wikipedia: Mexico

Below I present an exploratory analysis of the average monthly temperature at the state level from 1985 to the end of 2015, measured through conventional and automatic stations. All code needed for the analysis was developed in R and is available in this GitHub repo under an open source GNU GPLv3 license.

The temperature data were provided by the Comisión Nacional del Agua (CONAGUA) and are available on the open data page of the Government of Mexico. These were read directly from the website to facilitate the reproducibility of the analysis. Subsequently, the data were preprocessed to be able to work with them properly in R. The variables to be considered are: the federative entity, the year, the month and the corresponding temperature.

First, I plot a heat map of the values for each of the states. The chart I get shows a number of interesting patterns at the state level. The most interesting are summarized below.

Average temperature from 1985 to 2015 in each of the 32 states of Mexico.

Tabasco: the hottest state

The hottest state is Tabasco, with an average temperature of 26.84°C in 30 years.

Tlaxcala: the coldest state

The coldest state is Tlaxcala, with an average temperature of 14.44ºC in 30 years.

Sonora: the most variable state

The state with the largest temperature changes is Sonora, with an average annual temperature variability of 6.0964ºC.

Guerrero: the most stable state

The state with the most stable temperature is Guerrero, with an average annual temperature variability of 1.339ºC.

Honorable Mention 1: Chiapas

One of the states where the increment of temperature in recent years is more noticeable is Chiapas. In 1985, the average annual temperature was 19.24ºC. By 2015, the average annual temperature rose to 21.21°C.

Honorable Mention 2: Nuevo Leon

The state of Nuevo Leon presents an interesting pattern from 2002 to 2005 because the state temperature decreased drastically with respect to previous years. From 2006 onwards, the temperature has increased and on average has remained higher with respect to temperatures prior to 2002.